@adamlui/scss-to-css 1.1.0 → 1.1.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
@@ -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.0-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.1.2-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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/scss-to-css",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Recursively compile all SCSS files into minified CSS",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -15,11 +15,10 @@
15
15
  },
16
16
  "scripts": {
17
17
  "test": "echo \"Error: no test specified\" && exit 1",
18
- "bump": "bash utils/bump.sh",
19
- "bump:patch": "bash utils/bump.sh",
18
+ "bump:patch": "bash utils/bump.sh patch",
20
19
  "bump:minor": "bash utils/bump.sh minor",
21
20
  "bump:major": "bash utils/bump.sh major",
22
- "publish:patch": "bash utils/bump.sh --publish",
21
+ "publish:patch": "bash utils/bump.sh patch --publish",
23
22
  "publish:minor": "bash utils/bump.sh minor --publish",
24
23
  "publish:major": "bash utils/bump.sh major --publish"
25
24
  },
package/scss-to-css.js CHANGED
@@ -23,21 +23,19 @@ if (process.argv[2] && !fs.existsSync(inputArg)) {
23
23
  }
24
24
 
25
25
  // Recursively find all SCSS files or arg-passed file
26
- const inputPath = path.resolve(process.cwd(), inputArg);
27
- const scssFiles = inputArg.endsWith('.scss') ? [inputPath]
28
- : (() => {
29
- const fileList = [];
30
- (function findSCSSfiles(dir) {
31
- const files = fs.readdirSync(dir);
32
- files.forEach(file => {
33
- const filePath = path.resolve(dir, file);
34
- if (fs.statSync(filePath).isDirectory())
35
- findSCSSfiles(filePath); // recursively find SCSS
36
- else if (/\.scss$/.test(file)) // SCSS file found
37
- fileList.push(filePath); // store it for minification
38
- });
39
- })(inputPath); return fileList;
40
- })();
26
+ const inputPath = path.resolve(process.cwd(), inputArg),
27
+ scssFiles = [];
28
+ if (inputArg.endsWith('.scss')) scssFiles.push(inputPath);
29
+ else (function findSCSSfiles(dir) {
30
+ const files = fs.readdirSync(dir);
31
+ files.forEach(file => {
32
+ const filePath = path.resolve(dir, file);
33
+ if (fs.statSync(filePath).isDirectory())
34
+ findSCSSfiles(filePath); // recursively find SCSS
35
+ else if (/\.scss$/.test(file)) // SCSS file found
36
+ scssFiles.push(filePath); // store it for minification
37
+ });
38
+ })(inputPath);
41
39
 
42
40
  // Compile SCSS files to CSS
43
41
  let generatedCnt = 0;
@@ -47,7 +45,7 @@ scssFiles.forEach(scssPath => {
47
45
  const outputDir = path.join(
48
46
  path.dirname(scssPath), // path of file to be minified
49
47
  outputArg.endsWith('.css') ? path.dirname(outputArg) : outputArg, // path from output arg
50
- outputArg ? '' : '../css' // ../css/ if no output arg used
48
+ path.dirname(scssPath).endsWith('scss') ? '../css' : '' // ../css/ if in scss/
51
49
  );
52
50
  const outputFilename = (
53
51
  outputArg.endsWith('.css') && inputArg.endsWith('.scss')