@adamlui/scss-to-css 1.4.0 → 1.4.1

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,8 @@
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-fcde7b.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.4.0-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.4.1-fc7811.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
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&labelColor=464646"></a>
8
9
 
9
10
  <img height=8px width="100%" src="https://github.com/adamlui/js-utils/blob/main/docs/images/aqua-separator.png">
10
11
 
@@ -27,7 +28,7 @@ npm install -D @adamlui/scss-to-css
27
28
  The basic **global command** is:
28
29
 
29
30
  ```
30
- scss-to-css
31
+ scsstocss
31
32
  ```
32
33
 
33
34
  Sample output:
@@ -41,7 +42,7 @@ Sample output:
41
42
  To specify **input/output** paths:
42
43
 
43
44
  ```
44
- scss-to-css [input_path] [output_path]
45
+ scsstocss [input_path] [output_path]
45
46
  ```
46
47
 
47
48
  - `[input_path]`: Path to SCSS file or directory containing SCSS files to be compiled, relative to the current working directory.
@@ -59,7 +60,7 @@ To use as a **package script**, edit your project's `package.json` like this:
59
60
  },
60
61
  ```
61
62
 
62
- Replace `<scss-to-css-cmd>` with `scss-to-css` + optional args. Then, `npm run build:css` can be used to run the command.
63
+ Replace `<scss-to-css-cmd>` with `scsstocss` + optional args. Then, `npm run build:css` can be used to run the command.
63
64
  <br><br>
64
65
 
65
66
  ## 📃 Example commands:
@@ -67,25 +68,25 @@ Replace `<scss-to-css-cmd>` with `scss-to-css` + optional args. Then, `npm run b
67
68
  - Compile all SCSS files in the **current directory** (outputs to `css/`):
68
69
 
69
70
  ```
70
- scss-to-css
71
+ scsstocss
71
72
  ```
72
73
 
73
74
  - Compile all SCSS files in a **specific directory** (outputs to `path/to/your/directory/css/`):
74
75
 
75
76
  ```
76
- scss-to-css path/to/your/directory
77
+ scsstocss path/to/your/directory
77
78
  ```
78
79
 
79
80
  - Compile a **specific file** (outputs to `path/to/your/css/file.min.css`):
80
81
 
81
82
  ```
82
- scss-to-css path/to/your/file.scss
83
+ scsstocss path/to/your/file.scss
83
84
  ```
84
85
 
85
86
  - Specify both **input and output** directories (outputs to `output_folder/`):
86
87
 
87
88
  ```
88
- scss-to-css input_folder output_folder
89
+ scsstocss input_folder output_folder
89
90
  ```
90
91
 
91
92
  ## 🏛️ MIT License
package/docs/SECURITY.md CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  If you find a vulnerability, please open a [draft security advisory](https://github.com/adamlui/js-utils/security/advisories/new).
4
4
 
5
- Pull requests are also welcome, but for safety reasons, send an email to adam@kudoai.com and wait for a response before making it public.
5
+ Pull requests are also welcome, but for safety reasons, send an email to <adam@kudoai.com> and wait for a response before making it public.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/scss-to-css",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Recursively compile all SCSS files into minified CSS",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -11,6 +11,7 @@
11
11
  "license": "MIT",
12
12
  "main": "scss-to-css.js",
13
13
  "bin": {
14
+ "scsstocss": "scss-to-css.js",
14
15
  "scss-to-css": "scss-to-css.js"
15
16
  },
16
17
  "scripts": {
package/scss-to-css.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Import libs
3
+ // Import LIBS
4
4
  const fs = require('fs'),
5
5
  path = require('path'),
6
6
  sass = require('sass');
@@ -11,16 +11,16 @@ const nc = '\x1b[0m', // no color
11
11
  by = '\x1b[1;33m', // bright yellow
12
12
  bg = '\x1b[1;92m'; // bright green
13
13
 
14
- // Show help screen if -h or --help passed
14
+ // Show HELP screen if -h or --help passed
15
15
  if (process.argv.some(arg => /^--?h(?:elp)?$/.test(arg))) {
16
16
 
17
17
  // Print help
18
- console.info(`\n${by}scss-to-css [inputPath] [outputPath] [options]${nc}`);
18
+ console.info(`\n${by}scsstocss [inputPath] [outputPath] [options]${nc}`);
19
19
  console.info('\nPath arguments:');
20
- printWrappedMsg(' [input_path] '
20
+ printWrappedMsg(' [inputPath] '
21
21
  + 'Path to SCSS file or directory containing SCSS files to be compiled,'
22
22
  + ' relative to the current working directory.');
23
- printWrappedMsg(' [output_path] '
23
+ printWrappedMsg(' [outputPath] '
24
24
  + 'Path to file or directory where CSS + sourcemap files will be stored,'
25
25
  + ' relative to original file location (if not provided, css/ is used).');
26
26
  console.info('\nConfig options:');
@@ -30,34 +30,11 @@ if (process.argv.some(arg => /^--?h(?:elp)?$/.test(arg))) {
30
30
  printWrappedMsg(' -h, --help Display this help screen.');
31
31
  printWrappedMsg(' -v, --version Show version number.');
32
32
 
33
- function printWrappedMsg(msg) { // indents 2nd+ lines
34
- const terminalWidth = process.stdout.columns || 80,
35
- indentation = 29, lines = [], words = msg.match(/\S+|\s+/g);
36
-
37
- // Split msg into lines of appropriate lengths
38
- let currentLine = '';
39
- words.forEach(word => {
40
- const lineLength = terminalWidth - ( lines.length === 0 ? 0 : indentation );
41
- if (currentLine.length + word.length > lineLength) { // cap/store it
42
- lines.push(lines.length === 0 ? currentLine : currentLine.trimStart());
43
- currentLine = '';
44
- }
45
- currentLine += word;
46
- });
47
- lines.push(lines.length === 0 ? currentLine : currentLine.trimStart());
48
-
49
- // Print formatted msg
50
- lines.forEach((line, index) => {
51
- if (index === 0) console.info(line); // print 1st line unindented
52
- else console.info(' '.repeat(indentation) + line); // print subsequent lines indented
53
- });
54
- }
55
-
56
- // Show version number if -v or --version passed
57
- } else if (process.argv.some(arg => /^--?v(?:er(?:s(?:ion)?)?)?$/.test(arg))) {
33
+ // Show VERSION number if -v or --version passed
34
+ } else if (process.argv.some(arg => /^--?ve?r?s?i?o?n?$/.test(arg))) {
58
35
  console.info('v' + require('./package.json').version);
59
36
 
60
- } else { // run main routine
37
+ } else { // run MAIN routine
61
38
 
62
39
  // Init I/O args
63
40
  const [inputArg = '', outputArg = ''] = ( // default to empty strings for error-less handling
@@ -71,7 +48,7 @@ if (process.argv.some(arg => /^--?h(?:elp)?$/.test(arg))) {
71
48
  if (inputArg && !fs.existsSync(inputPath)) {
72
49
  console.error(`\n${br}Error: First arg must be an existing file or directory.`
73
50
  + `\n${ inputPath } does not exist.${nc}`
74
- + '\n\nExample valid command: \n>> scss-to-css . output.min.css');
51
+ + '\n\nExample valid command: \n>> scsstocss . output.min.css');
75
52
  process.exit(1);
76
53
  }
77
54
 
@@ -136,3 +113,26 @@ if (process.argv.some(arg => /^--?h(?:elp)?$/.test(arg))) {
136
113
  + ' generated.');
137
114
  } else console.info(`${by}No SCSS files found.${nc}`);
138
115
  }
116
+
117
+ function printWrappedMsg(msg) { // truncates msg, indents 2nd+ lines
118
+ const terminalWidth = process.stdout.columns || 80,
119
+ indentation = 29, lines = [], words = msg.match(/\S+|\s+/g);
120
+
121
+ // Split msg into lines of appropriate lengths
122
+ let currentLine = '';
123
+ words.forEach(word => {
124
+ const lineLength = terminalWidth - ( lines.length === 0 ? 0 : indentation );
125
+ if (currentLine.length + word.length > lineLength) { // cap/store it
126
+ lines.push(lines.length === 0 ? currentLine : currentLine.trimStart());
127
+ currentLine = '';
128
+ }
129
+ currentLine += word;
130
+ });
131
+ lines.push(lines.length === 0 ? currentLine : currentLine.trimStart());
132
+
133
+ // Print formatted msg
134
+ lines.forEach((line, index) => console.info(
135
+ index === 0 ? line // print 1st line unindented
136
+ : ' '.repeat(indentation) + line // print subsequent lines indented
137
+ ));
138
+ }