@adamlui/scss-to-css 1.5.1 → 1.5.2

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
@@ -4,7 +4,7 @@
4
4
 
5
5
  <a href="https://www.npmjs.com/package/@adamlui/scss-to-css"><img height=31 src="https://img.shields.io/npm/dt/%40adamlui%2Fscss-to-css?logo=npm&logoColor=white&labelColor=464646&style=for-the-badge"></a>
6
6
  <a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-red.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
7
- <a href="https://www.npmjs.com/package/@adamlui/scss-to-css?activeTab=versions"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.5.1-fc7811.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
7
+ <a href="https://www.npmjs.com/package/@adamlui/scss-to-css?activeTab=versions"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.5.2-fc7811.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
8
8
  <a href="https://www.npmjs.com/package/@adamlui/scss-to-css?activeTab=code"><img height=31 src="https://img.shields.io/npm/unpacked-size/%40adamlui%2Fscss-to-css?style=for-the-badge&logo=ebox&logoColor=white&color=blue&labelColor=464646"></a>
9
9
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:scss-to-css/scss-to-css.js"><img height=31 src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fsonarcloud.io%2Fapi%2Fmeasures%2Fcomponent%3Fcomponent%3Dadamlui_js-utils%3Ascss-to-css%2Fscss-to-css.js%26metricKeys%3Dvulnerabilities&query=%24.component.measures.0.value&style=for-the-badge&logo=sonarcloud&logoColor=white&labelColor=464646&label=Vulnerabilities&color=gold"></a>
10
10
 
@@ -38,7 +38,7 @@ Sample output:
38
38
 
39
39
  <img src="https://github.com/adamlui/js-utils/blob/main/scss-to-css/media/images/sample-output.png">
40
40
 
41
- **💡 Note:** Source maps are also generated by default unless `-S` or `--disable-source-maps` is passed.
41
+ **💡 Note:** Source maps are also generated by default unless `-S` or `--no-source-maps` is passed.
42
42
 
43
43
  #
44
44
 
@@ -51,7 +51,7 @@ scss-to-css [input_path] [output_path]
51
51
  - `[input_path]`: Path to SCSS file or directory containing SCSS files to be compiled, relative to the current working directory.
52
52
  - `[output_path]`: Path to file or directory where CSS + sourcemap files will be stored, relative to original file location (if not provided, `css/` is used).
53
53
 
54
- **💡 Note:** If folders are passed, files will be processed recursively. To include dotfolders, pass `-d` or `--include-dotfolders`.
54
+ **💡 Note:** If folders are passed, files will be processed recursively unless `-R` or `--no-recursion` is passed. To include dotfolders, pass `-d` or `--include-dotfolders`.
55
55
 
56
56
  #
57
57
 
@@ -66,31 +66,48 @@ To use as a **package script**, in your project's `package.json`:
66
66
  Replace `<scss-to-css-cmd>` with `scss-to-css` + optional args. Then, `npm run build:css` can be used to run the command.
67
67
  <br><br>
68
68
 
69
- ## 📃 Example commands:
69
+ ### Command line options
70
70
 
71
- - Compile all SCSS files in the **current directory** (outputs to `css/`):
71
+ ```
72
+ Config options:
73
+ -n, --dry-run Don't actually compile the file(s), just
74
+ show if they will be processed.
75
+ -d, --include-dotfolders Include dotfolders in file search.
76
+ -S, --no-source-maps Prevent source maps from being generated.
77
+ -M, --no-minify Disable minification of output CSS.
78
+ -R, --no-recursion Disable recursive file searching.
79
+ -q, --quiet Suppress all logging except errors.
80
+
81
+ Info commands:
82
+ -h, --help Display this help screen.
83
+ -v, --version Show version number.
84
+ ```
72
85
 
73
- ```
74
- scss-to-css
75
- ```
86
+ ### Example commands
76
87
 
77
- - Compile all SCSS files in a **specific directory** (outputs to `path/to/your/directory/css/`):
88
+ Compile all SCSS files in the **current directory** (outputs to `css/`):
78
89
 
79
- ```
80
- scss-to-css path/to/your/directory
81
- ```
90
+ ```
91
+ scss-to-css
92
+ ```
82
93
 
83
- - Compile a **specific file** (outputs to `path/to/your/css/file.min.css`):
94
+ Compile all SCSS files in a **specific directory** (outputs to `path/to/your/directory/css/`):
84
95
 
85
- ```
86
- scss-to-css path/to/your/file.scss
87
- ```
96
+ ```
97
+ scss-to-css path/to/your/directory
98
+ ```
88
99
 
89
- - Specify both **input and output** directories (outputs to `output_folder/`):
100
+ Compile a **specific file** (outputs to `path/to/your/css/file.min.css`):
90
101
 
91
- ```
92
- scss-to-css input_folder output_folder
93
- ```
102
+ ```
103
+ scss-to-css path/to/your/file.scss
104
+ ```
105
+
106
+ Specify both **input and output** directories (outputs to `output_folder/`):
107
+
108
+ ```
109
+ scss-to-css input_folder output_folder
110
+ ```
94
111
 
95
112
  **💡 Note:** Output CSS is minified unless `-M` or `--no-minify` is passed.
96
113
  <br><br>
@@ -104,23 +121,11 @@ Please consider [giving a GitHub ⭐](https://github.com/adamlui/js-utils) if th
104
121
 
105
122
  **Copyright (c) 2024 [Adam Lui](https://github.com/adamlui)**
106
123
 
107
- Permission is hereby granted, free of charge, to any person obtaining a copy
108
- of this software and associated documentation files (the "Software"), to deal
109
- in the Software without restriction, including without limitation the rights
110
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
111
- copies of the Software, and to permit persons to whom the Software is
112
- furnished to do so, subject to the following conditions:
113
-
114
- The above copyright notice and this permission notice shall be included in all
115
- copies or substantial portions of the Software.
116
-
117
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
118
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
119
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
120
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
121
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
122
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
123
- SOFTWARE.
124
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
125
+
126
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
127
+
128
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
124
129
 
125
130
  <br>
126
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/scss-to-css",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
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
@@ -18,6 +18,8 @@ const config = {
18
18
  /^--?(?:dd?|(?:include-?)?dot-?(?:folder|dir(?:ector(?:y|ie))?)s?)$/.test(arg)),
19
19
  disableSourceMaps: process.argv.some(arg =>
20
20
  /^--?(?:S|(?:exclude|disable|no)-?so?u?rce?-?maps?)$/.test(arg)),
21
+ noRecursion: process.argv.some(arg =>
22
+ /^--?(?:R|(?:disable|no)-?recursion)$/.test(arg)),
21
23
  noMinify: process.argv.some(arg =>
22
24
  /^--?(?:M|(?:disable|no)-?minif(?:y|ication))$/.test(arg)),
23
25
  quietMode: process.argv.some(arg => /^--?q(?:uiet)?$/.test(arg))
@@ -38,8 +40,9 @@ if (process.argv.some(arg => /^--?h(?:elp)?$/.test(arg))) {
38
40
  printHelp(' -n, --dry-run Don\'t actually compile the file(s),'
39
41
  + ' just show if they will be processed.');
40
42
  printHelp(' -d, --include-dotfolders Include dotfolders in file search.');
41
- printHelp(' -S, --disable-source-maps Prevent source maps from being generated.');
43
+ printHelp(' -S, --no-source-maps Prevent source maps from being generated.');
42
44
  printHelp(' -M, --no-minify Disable minification of output CSS.');
45
+ printHelp(' -R, --no-recursion Disable recursive file searching.');
43
46
  printHelp(' -q, --quiet Suppress all logging except errors.');
44
47
  printHelp('\nInfo commands:');
45
48
  printHelp(' -h, --help Display this help screen.');
@@ -68,7 +71,7 @@ if (process.argv.some(arg => /^--?h(?:elp)?$/.test(arg))) {
68
71
  process.exit(1);
69
72
  }
70
73
 
71
- // Recursively find all eligible SCSS files or arg-passed file
74
+ // Find all eligible SCSS files or arg-passed file
72
75
  const scssFiles = [];
73
76
  if (inputArg.endsWith('.scss')) scssFiles.push(inputPath);
74
77
  else (function findSCSSfiles(dir) {
@@ -76,7 +79,7 @@ if (process.argv.some(arg => /^--?h(?:elp)?$/.test(arg))) {
76
79
  files.forEach(file => {
77
80
  const filePath = path.resolve(dir, file);
78
81
  if (fs.statSync(filePath).isDirectory() &&
79
- (config.includeDotFolders || !file.startsWith('.')))
82
+ (config.includeDotFolders || !file.startsWith('.')) && !config.noRecursion)
80
83
  findSCSSfiles(filePath); // recursively find SCSS in eligible dir
81
84
  else if (file.endsWith('.scss')) // SCSS file found
82
85
  scssFiles.push(filePath); // store it for compilation