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.
- package/buildScripts/buildThemes.mjs +61 -63
- package/package.json +1 -1
|
@@ -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
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
-
|
|
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
|
-
|
|
338
|
-
|
|
349
|
+
for (; i < len; i++) {
|
|
350
|
+
src = '../' + src;
|
|
339
351
|
}
|
|
340
352
|
|
|
341
|
-
map =
|
|
353
|
+
map.sources = [src];
|
|
354
|
+
}
|
|
342
355
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
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
|
-
|
|
351
|
-
|
|
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
|
-
|
|
370
|
+
if (result.map) {
|
|
371
|
+
fs.writeFileSync(result.opts.to + '.map', result.map.toString());
|
|
355
372
|
}
|
|
356
373
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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
|
|