@fluffjs/cli 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/Cli.js +26 -8
  2. package/package.json +1 -1
package/Cli.js CHANGED
@@ -309,10 +309,19 @@ Examples:
309
309
  let inlineStyles = '';
310
310
  if (target.styles && target.styles.length > 0) {
311
311
  const styleContents = [];
312
- for (const styleGlob of target.styles) {
313
- const styleFiles = this.findFiles(srcDir, [styleGlob]);
314
- for (const styleFile of styleFiles) {
315
- styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
312
+ for (const stylePath of target.styles) {
313
+ const fullPath = path.resolve(srcDir, stylePath);
314
+ if (fs.existsSync(fullPath) && fs.statSync(fullPath).isFile()) {
315
+ styleContents.push(fs.readFileSync(fullPath, 'utf-8'));
316
+ }
317
+ else {
318
+ const styleFiles = this.findFiles(srcDir, [stylePath]);
319
+ if (styleFiles.length === 0) {
320
+ console.warn(` ⚠ Style not found: ${fullPath}`);
321
+ }
322
+ for (const styleFile of styleFiles) {
323
+ styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
324
+ }
316
325
  }
317
326
  }
318
327
  if (styleContents.length > 0) {
@@ -487,10 +496,19 @@ Examples:
487
496
  let inlineStyles = '';
488
497
  if (target.styles && target.styles.length > 0) {
489
498
  const styleContents = [];
490
- for (const styleGlob of target.styles) {
491
- const styleFiles = this.findFiles(srcDir, [styleGlob]);
492
- for (const styleFile of styleFiles) {
493
- styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
499
+ for (const stylePath of target.styles) {
500
+ const fullPath = path.resolve(srcDir, stylePath);
501
+ if (fs.existsSync(fullPath) && fs.statSync(fullPath).isFile()) {
502
+ styleContents.push(fs.readFileSync(fullPath, 'utf-8'));
503
+ }
504
+ else {
505
+ const styleFiles = this.findFiles(srcDir, [stylePath]);
506
+ if (styleFiles.length === 0) {
507
+ console.warn(` ⚠ Style not found: ${fullPath}`);
508
+ }
509
+ for (const styleFile of styleFiles) {
510
+ styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
511
+ }
494
512
  }
495
513
  }
496
514
  if (styleContents.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluffjs/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",