@adamlui/scss-to-css 1.1.2 → 1.2.0

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  ### Recursively compile all SCSS files into minified CSS.
4
4
 
5
5
  <a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-fcde7b.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
6
- <a href="https://www.npmjs.com/package/@adamlui/scss-to-css"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.1.2-fc7811.svg?logo=npm&logoColor=white&labelColor=464646&style=for-the-badge"></a>
6
+ <a href="https://www.npmjs.com/package/@adamlui/scss-to-css"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.2.0-fc7811.svg?logo=npm&logoColor=white&labelColor=464646&style=for-the-badge"></a>
7
7
 
8
8
  <img height=8px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/media/images/separators/aqua.png">
9
9
 
@@ -44,7 +44,7 @@ scss-to-css <input_path> <output_path>
44
44
  ```
45
45
 
46
46
  - `<input_path>`: Path to directory containing SCSS files to be compiled, relative to the current working directory.
47
- - `<output_path>`: Path to directory where CSS/sourcemap files will be stored, relative to original file location. (If not provided, same location is used.)
47
+ - `<output_path>`: Path to directory where CSS/sourcemap files will be stored, relative to original file location. (If not provided, `css/` is used.)
48
48
 
49
49
  **💡 Note:** The paths can be either folders or specific files. If folders are passed, files will be processed recursively.
50
50
 
@@ -63,19 +63,19 @@ Replace `<scss-to-css-cmd>` with `scss-to-css` + optional args. Then, `npm run b
63
63
 
64
64
  ## 📃 Example commands:
65
65
 
66
- - Compile all SCSS files in the **current directory** (outputs to same directory`):
66
+ - Compile all SCSS files in the **current directory** (outputs to `css/`):
67
67
 
68
68
  ```
69
69
  scss-to-css
70
70
  ```
71
71
 
72
- - Compile all SCSS files in a **specific directory** (outputs to `path/to/your/directory/`):
72
+ - Compile all SCSS files in a **specific directory** (outputs to `path/to/your/directory/css/`):
73
73
 
74
74
  ```
75
75
  scss-to-css path/to/your/directory
76
76
  ```
77
77
 
78
- - Compile a **specific file** (outputs to `path/to/your/minified/file.min.css`):
78
+ - Compile a **specific file** (outputs to `path/to/your/css/file.min.css`):
79
79
 
80
80
  ```
81
81
  scss-to-css path/to/your/file.scss
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/scss-to-css",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Recursively compile all SCSS files into minified CSS",
5
5
  "author": {
6
6
  "name": "Adam Lui",
package/scss-to-css.js CHANGED
@@ -44,8 +44,9 @@ scssFiles.forEach(scssPath => {
44
44
  try { // to compile it
45
45
  const outputDir = path.join(
46
46
  path.dirname(scssPath), // path of file to be minified
47
- outputArg.endsWith('.css') ? path.dirname(outputArg) : outputArg, // path from output arg
48
- path.dirname(scssPath).endsWith('scss') ? '../css' : '' // ../css/ if in scss/
47
+ /(src|s[ac]ss)$/.test(path.dirname(scssPath)) ? '../css' // + ../css/ if in *(src|sass|scss)/
48
+ : outputArg.endsWith('.css') ? path.dirname(outputArg) // or path from file output arg
49
+ : outputArg || 'css' // or path from path output arg or css/ from no arg
49
50
  );
50
51
  const outputFilename = (
51
52
  outputArg.endsWith('.css') && inputArg.endsWith('.scss')
@@ -65,5 +66,9 @@ scssFiles.forEach(scssPath => {
65
66
  });
66
67
 
67
68
  // Print final summary
68
- if (generatedCnt) console.info(`\n${bg}Compilation complete!${nc}\n${ generatedCnt } files generated.`);
69
- else console.info(`\n${by}No SCSS files found.${nc}`);
69
+ if (generatedCnt) {
70
+ const isPlural = generatedCnt/2 > 1;
71
+ console.info(`\n${bg}Compilation complete!${nc}`);
72
+ console.info(`\n${ generatedCnt/2 } CSS file${ isPlural ? 's' : '' }`
73
+ + ` + ${ generatedCnt/2 } source map${ isPlural ? 's' : '' } generated.`);
74
+ } else console.info(`\n${by}No SCSS files found.${nc}`);