@fluffjs/cli 0.1.5 → 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 +24 -12
  2. package/package.json +1 -1
package/Cli.js CHANGED
@@ -309,13 +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
- if (styleFiles.length === 0) {
315
- console.warn(` ⚠ Style not found: ${path.resolve(srcDir, styleGlob)}`);
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
316
  }
317
- for (const styleFile of styleFiles) {
318
- styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
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
+ }
319
325
  }
320
326
  }
321
327
  if (styleContents.length > 0) {
@@ -490,13 +496,19 @@ Examples:
490
496
  let inlineStyles = '';
491
497
  if (target.styles && target.styles.length > 0) {
492
498
  const styleContents = [];
493
- for (const styleGlob of target.styles) {
494
- const styleFiles = this.findFiles(srcDir, [styleGlob]);
495
- if (styleFiles.length === 0) {
496
- console.warn(` ⚠ Style not found: ${path.resolve(srcDir, styleGlob)}`);
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'));
497
503
  }
498
- for (const styleFile of styleFiles) {
499
- styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
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
+ }
500
512
  }
501
513
  }
502
514
  if (styleContents.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluffjs/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",