@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 +5 -5
- package/package.json +1 -1
- package/scss-to-css.js +9 -4
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.
|
|
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,
|
|
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
|
|
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/
|
|
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
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
|
-
|
|
48
|
-
|
|
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)
|
|
69
|
-
|
|
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}`);
|