neo.mjs 4.0.25 → 4.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -192,7 +192,7 @@ if (programOpts.info) {
192
192
  } else {
193
193
  fileInfo = path.parse(file);
194
194
 
195
- if (!fileInfo.name.startsWith('_')) {
195
+ if (!fileInfo.name.startsWith('_') && fileInfo.ext === '.scss') {
196
196
  className = relativePath === '' ? fileInfo.name : `${relativePath.substring(1)}/${fileInfo.name}`;
197
197
  className = className.split('/').join('.');
198
198
 
@@ -318,78 +318,76 @@ if (programOpts.info) {
318
318
  }
319
319
 
320
320
  files.forEach(file => {
321
- if (file.path.endsWith('.scss')) {
322
- addItemToThemeMap(file, target, useCssVars);
323
-
324
- let folderPath = path.resolve(cwd, `dist/${mode}/css${suffix}/${target}/${file.relativePath}`),
325
- destPath = path.resolve(folderPath, `${file.name}.css`);
326
-
327
- fs.readFile(file.path).then(content => {
328
- let result = sass.renderSync({
329
- data : data + scssCombine(content.toString(), path.resolve(neoPath, scssPath, target, file.relativePath)),
330
- outFile : destPath,
331
- sourceMap : devMode,
332
- sourceMapEmbed: false
333
- });
321
+ addItemToThemeMap(file, target, useCssVars);
322
+
323
+ let folderPath = path.resolve(cwd, `dist/${mode}/css${suffix}/${target}/${file.relativePath}`),
324
+ destPath = path.resolve(folderPath, `${file.name}.css`);
325
+
326
+ fs.readFile(file.path).then(content => {
327
+ let result = sass.renderSync({
328
+ data : data + scssCombine(content.toString(), path.resolve(neoPath, scssPath, target, file.relativePath)),
329
+ outFile : destPath,
330
+ sourceMap : devMode,
331
+ sourceMapEmbed: false
332
+ });
333
+
334
+ const plugins = [autoprefixer];
335
+
336
+ if (mode === 'production') {
337
+ plugins.push(cssnano);
338
+ }
339
+
340
+ map = result.map?.toString();
334
341
 
335
- const plugins = [autoprefixer];
342
+ if (map) {
343
+ // https://github.com/neomjs/neo/issues/1970
344
+ map = JSON.parse(map);
345
+ let len = file.relativePath.split('/').length,
346
+ src = `${target}${file.relativePath}/${file.name}.scss`,
347
+ i = 0;
336
348
 
337
- if (mode === 'production') {
338
- plugins.push(cssnano);
349
+ for (; i < len; i++) {
350
+ src = '../' + src;
339
351
  }
340
352
 
341
- map = result.map?.toString();
353
+ map.sources = [src];
354
+ }
342
355
 
343
- if (map) {
344
- // https://github.com/neomjs/neo/issues/1970
345
- map = JSON.parse(map);
346
- let len = file.relativePath.split('/').length,
347
- src = `${target}${file.relativePath}/${file.name}.scss`,
348
- i = 0;
356
+ postcss(plugins).process(result.css, {
357
+ from: file.path,
358
+ to : destPath,
359
+ map : !devMode ? null : {
360
+ prev: map && JSON.stringify(map)
361
+ }
362
+ }).then(result => {
363
+ fs.mkdirpSync(folderPath);
364
+ fileCount[mode][varsFlag]++;
349
365
 
350
- for (; i < len; i++) {
351
- src = '../' + src;
352
- }
366
+ const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
367
+ console.log('Writing file:', (fileCount[mode].vars + fileCount[mode].noVars), chalk.blue(`${processTime}s`), destPath);
368
+ fs.writeFileSync(destPath, result.css, () => true);
353
369
 
354
- map.sources = [src];
370
+ if (result.map) {
371
+ fs.writeFileSync(result.opts.to + '.map', result.map.toString());
355
372
  }
356
373
 
357
- postcss(plugins).process(result.css, {
358
- from: file.path,
359
- to : destPath,
360
- map : !devMode ? null : {
361
- prev: map && JSON.stringify(map)
362
- }
363
- }).then(result => {
364
- fs.mkdirpSync(folderPath);
365
- fileCount[mode][varsFlag]++;
366
-
367
- const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
368
- console.log('Writing file:', (fileCount[mode].vars + fileCount[mode].noVars), chalk.blue(`${processTime}s`), destPath);
369
- fs.writeFileSync(destPath, result.css, () => true);
370
-
371
- if (result.map) {
372
- fs.writeFileSync(result.opts.to + '.map', result.map.toString());
373
- }
374
-
375
- if (fileCount[mode][varsFlag] === totalFiles[mode][varsFlag]) {
376
- fs.writeFileSync(
377
- path.resolve(cwd, useCssVars ? themeMapFile : themeMapFileNoVars),
378
- JSON.stringify(useCssVars ? themeMap : themeMapNoVars, null, 0)
379
- );
380
-
381
- fs.mkdirpSync(path.join(cwd, '/dist/', mode, '/resources'), {
382
- recursive: true
383
- });
384
-
385
- fs.writeFileSync(
386
- path.join(cwd, '/dist/', mode, useCssVars ? themeMapFile : themeMapFileNoVars),
387
- JSON.stringify(useCssVars ? themeMap : themeMapNoVars, null, 0)
388
- );
389
- }
390
- });
374
+ if (fileCount[mode][varsFlag] === totalFiles[mode][varsFlag]) {
375
+ fs.writeFileSync(
376
+ path.resolve(cwd, useCssVars ? themeMapFile : themeMapFileNoVars),
377
+ JSON.stringify(useCssVars ? themeMap : themeMapNoVars, null, 0)
378
+ );
379
+
380
+ fs.mkdirpSync(path.join(cwd, '/dist/', mode, '/resources'), {
381
+ recursive: true
382
+ });
383
+
384
+ fs.writeFileSync(
385
+ path.join(cwd, '/dist/', mode, useCssVars ? themeMapFile : themeMapFileNoVars),
386
+ JSON.stringify(useCssVars ? themeMap : themeMapNoVars, null, 0)
387
+ );
388
+ }
391
389
  });
392
- }
390
+ });
393
391
  });
394
392
  }
395
393
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "4.0.25",
3
+ "version": "4.0.26",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {