@adamlui/scss-to-css 1.7.13 → 1.8.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 +35 -32
- package/dist/scss-to-css.min.js +5 -3
- package/docs/README.md +35 -32
- package/docs/SECURITY.md +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
<img height=14 src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/earth-icon/black/icon32.svg">
|
|
7
7
|
</picture>
|
|
8
8
|
English |
|
|
9
|
-
<a href="https://github.com/adamlui/
|
|
10
|
-
<a href="https://github.com/adamlui/
|
|
11
|
-
<a href="https://github.com/adamlui/
|
|
12
|
-
<a href="https://github.com/adamlui/
|
|
13
|
-
<a href="https://github.com/adamlui/
|
|
14
|
-
<a href="https://github.com/adamlui/
|
|
15
|
-
<a href="https://github.com/adamlui/
|
|
16
|
-
<a href="https://github.com/adamlui/
|
|
17
|
-
<a href="https://github.com/adamlui/
|
|
18
|
-
<a href="https://github.com/adamlui/
|
|
19
|
-
<a href="https://github.com/adamlui/
|
|
20
|
-
<a href="https://github.com/adamlui/
|
|
21
|
-
<a href="https://github.com/adamlui/
|
|
9
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/zh-cn#readme">简体中文</a> |
|
|
10
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/zh-tw#readme">繁體中文</a> |
|
|
11
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/ja#readme">日本語</a> |
|
|
12
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/hi#readme">हिंदी</a> |
|
|
13
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/bn#readme">বাংলা</a> |
|
|
14
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/mr#readme">मराठी</a> |
|
|
15
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/pa#readme">ਪੰਜਾਬੀ</a> |
|
|
16
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/de#readme">Deutsch</a> |
|
|
17
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/es#readme">Español</a> |
|
|
18
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/fr#readme">Français</a> |
|
|
19
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/it#readme">Italiano</a> |
|
|
20
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/nl#readme">Nederlands</a> |
|
|
21
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/pt#readme">Português</a>
|
|
22
22
|
</h6>
|
|
23
23
|
</td>
|
|
24
24
|
</table>
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
|
|
30
30
|
<a href="https://www.npmjs.com/package/@adamlui/scss-to-css"><img height=31 src="https://img.shields.io/npm/dm/%40adamlui%2Fscss-to-css?logo=npm&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
31
31
|
<a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
32
|
-
<a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.
|
|
32
|
+
<a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.8.0"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.8.0-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
33
33
|
<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>
|
|
34
|
-
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=
|
|
34
|
+
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_scss-to-css:node.js/src/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_scss-to-css%3Anode.js%2Fsrc%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>
|
|
35
35
|
<a href="https://github.com/toolleeo/cli-apps#conversion"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
36
36
|
|
|
37
37
|
<img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
|
|
@@ -70,7 +70,7 @@ $ scss-to-css
|
|
|
70
70
|
|
|
71
71
|
Sample output:
|
|
72
72
|
|
|
73
|
-
<img src="https://
|
|
73
|
+
<img src="https://raw.githubusercontent.com/adamlui/scss-to-css/main/node.js/media/images/screenshots/cli-scss-to-css-docs.png">
|
|
74
74
|
|
|
75
75
|
**💡 Note:** Source maps are also generated by default unless `-S` or `--no-source-maps` is passed.
|
|
76
76
|
|
|
@@ -172,20 +172,23 @@ const scssToCSS = require('@adamlui/scss-to-css');
|
|
|
172
172
|
|
|
173
173
|
#
|
|
174
174
|
|
|
175
|
-
### `compile(
|
|
175
|
+
### `compile(input[, options])`
|
|
176
176
|
|
|
177
|
-
Compiles SCSS
|
|
177
|
+
Compiles SCSS based on the string input supplied.
|
|
178
178
|
|
|
179
|
-
If
|
|
179
|
+
If **source code** is passed, it is directly compiled, then an object containing `srcPath` + `code` + `srcMap` + `error` is returned:
|
|
180
180
|
|
|
181
181
|
```js
|
|
182
|
-
const
|
|
182
|
+
const srcCode = 'h1 { font-size: 40px ; code { font-face: Roboto Mono }}',
|
|
183
|
+
compileResult = scssToCSS.compile(srcCode);
|
|
183
184
|
|
|
184
185
|
console.log(compileResult.error); // outputs runtime error, or `undefined` if no error
|
|
185
|
-
console.log(compileResult.code); // outputs
|
|
186
|
+
console.log(compileResult.code); // outputs minified CSS: 'h1{font-size:40px}h1 code{font-face:Roboto Mono}'
|
|
186
187
|
```
|
|
187
188
|
|
|
188
|
-
If a **
|
|
189
|
+
If a **file path** is passed, the file's code is loaded then compiled to CSS, returning an object like above.
|
|
190
|
+
|
|
191
|
+
If a **directory path** is passed, SCSS files are searched for (recursively by default), each one's code is loaded then compiled, then an array of objects containing `srcPath` + `code` + `srcMap` + `error` is returned:
|
|
189
192
|
|
|
190
193
|
```js
|
|
191
194
|
// Outputs paths to SCSS files in working directory + all nested directories
|
|
@@ -217,12 +220,12 @@ Name | Desciption | Default
|
|
|
217
220
|
|
|
218
221
|
### `findSCSS(searchDir[, options])`
|
|
219
222
|
|
|
220
|
-
Searches for all SCSS files within the `searchDir` string passed (useful for discovering what files [`compile()`](#
|
|
223
|
+
Searches for all SCSS files within the `searchDir` string passed (useful for discovering what files [`compile()`](#compileinput-options) will process) and returns an array containing their filepaths.
|
|
221
224
|
|
|
222
225
|
Options are boolean, passed as object properties. For example:
|
|
223
226
|
|
|
224
227
|
```js
|
|
225
|
-
// Search for SCSS files in exactly assets/scss
|
|
228
|
+
// Search for SCSS files in exactly assets/scss
|
|
226
229
|
const searchResults = scssToCSS.findSCSS('assets/scss', { recursive: false });
|
|
227
230
|
console.log(searchResults);
|
|
228
231
|
|
|
@@ -270,21 +273,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
270
273
|
|
|
271
274
|
> Recursively compress all images to WEBPs.
|
|
272
275
|
<br>[Download](https://raw.githubusercontent.com/adamlui/js-utils/main/img-to-webp/img-to-webp.js) /
|
|
273
|
-
[Discuss](https://js-utils.com/discussions)
|
|
276
|
+
[Discuss](https://github.js-utils.com/discussions)
|
|
274
277
|
|
|
275
|
-
### [</> minify.js](https://minify-js.org)
|
|
278
|
+
### [</> minify.js](https://minify-js.org) <a href="https://github.com/toolleeo/cli-apps#programming"><img height=18 src="https://awesome.re/mentioned-badge.svg"></a>
|
|
276
279
|
|
|
277
280
|
> Recursively minify all JavaScript files.
|
|
278
|
-
<br>[Install](https://
|
|
279
|
-
[Readme](
|
|
280
|
-
[CLI usage](
|
|
281
|
-
[API usage](
|
|
282
|
-
[Discuss](https://js-utils.com/discussions)
|
|
281
|
+
<br>[Install](https://node.minify-js.org/#-installation) /
|
|
282
|
+
[Readme](https://node.minify-js.org/#readme) /
|
|
283
|
+
[CLI usage](https://node.minify-js.org/#-command-line-usage) /
|
|
284
|
+
[API usage](https://node.minify-js.org/#-api-usage) /
|
|
285
|
+
[Discuss](https://github.js-utils.com/discussions)
|
|
283
286
|
|
|
284
287
|
<br>
|
|
285
288
|
|
|
286
289
|
<img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
|
|
287
290
|
|
|
288
291
|
<picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/adamlui/js-utils/main/media/images/icons/home/white/icon32x27.png"><img height=13 src="https://raw.githubusercontent.com/adamlui/js-utils/main/media/images/icons/home/dark-gray/icon32x27.png"></picture> <a href="https://js-utils.com">**More JavaScript utilities**</a> /
|
|
289
|
-
<a href="https://
|
|
292
|
+
<a href="https://github.com/adamlui/scss-to-css/discussions">Discuss</a> /
|
|
290
293
|
<a href="#--scss-to-css">Back to top ↑</a>
|
package/dist/scss-to-css.min.js
CHANGED
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
* Source: https://code.js-utils.com/scss-to-css
|
|
5
5
|
* Documentation: https://docs.js-utils.com/scss-to-css
|
|
6
6
|
*/
|
|
7
|
-
const fs=require("fs"),path=require("path"),sass=require("sass");function findSCSS(o,r={}){var e="https://docs.js-utils.com/scss-to-css/#findscsssearchdir-options",s={recursive:!0,verbose:!0,dotFolders:!1};if("string"!=typeof o)console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string."),console.info("findSCSS() » For more help, please visit "+e);else{var i=path.resolve(process.cwd(),o);if(fs.existsSync(i)){if(validateOptions(r,s,e,"findSCSS('assets/scss', { verbose: false, dotFolders: true })")){r={...s,...r};const n=fs.readdirSync(o),
|
|
7
|
+
const fs=require("fs"),path=require("path"),sass=require("sass");function findSCSS(o,r={}){var e="https://docs.js-utils.com/scss-to-css/#findscsssearchdir-options",s={recursive:!0,verbose:!0,dotFolders:!1};if("string"!=typeof o)console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string."),console.info("findSCSS() » For more help, please visit "+e);else{var i=path.resolve(process.cwd(),o);if(fs.existsSync(i)){if(validateOptions(r,s,e,"findSCSS('assets/scss', { verbose: false, dotFolders: true })")){r={...s,...r};const n=fs.readdirSync(o),c=[];return r.verbose&&!r.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),n.forEach(e=>{var s=path.resolve(o,e);fs.statSync(s).isDirectory()&&"node_modules"!=e&&(r.dotFolders||!e.startsWith("."))&&r.recursive?c.push(...findSCSS(s,{...r,isRecursing:!0})):e.endsWith(".scss")&&c.push(s)}),!r.isRecursing&&r.verbose&&(console.info("findSCSS() » Search complete! "+(0==c.length?"No":c.length)+` file${0==c.length||1<c.length?"s":""} found.`),"compile"==findSCSS.caller.name||/cli(?:\.min)?\.js$/.test(require.main.filename)||console.info("findSCSS() » Check returned array.")),r.isRecursing||0<c.length?c:[]}}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${i} does not exist.`),console.info("findSCSS() » For more help, please visit "+e)}}function compile(e,o={}){var s="https://docs.js-utils.com/scss-to-css/#compileinput-options",r={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0};if("string"!=typeof e)console.error("compile() » ERROR: 1st arg <input> must be a string."),console.info("compile() » For more help, please visit "+s);else if(validateOptions(o,r,s,"compile('assets/scss', { recursive: false, minify: false })")){const c={style:(o={...r,...o}).minify?"compressed":"expanded",sourceMap:o.sourceMaps};if(fs.existsSync(e)){if(!e.endsWith(".scss"))return s=findSCSS(e,{recursive:o.recursive,verbose:o.verbose,dotFolders:o.dotFolders})?.map(e=>{o.verbose&&console.info(`compile() » Compiling ${e}...`);try{var s=sass.compile(e,c);return{code:s.css,srcMap:s.sourceMap,srcPath:e,error:void 0}}catch(e){return console.error(`
|
|
8
8
|
compile() » ERROR: ${e.message}
|
|
9
|
-
`),{error:e}}}).filter(e=>!e.error),o.verbose&&(0<
|
|
9
|
+
`),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}).filter(e=>!e.error),o.verbose&&(0<s.length?console.info("compile() » Compilation complete. Check returned object."):console.info("compile() » No SCSS files processed.")),s;o.verbose&&console.info(`compile() » Compiling ${e}...`);try{var i=sass.compile(e,c);return o.verbose&&!/cli(?:\.min)?\.js$/.test(require.main.filename)&&console.info("compile() » Compilation complete. Check returned object."),{code:i.css,srcMap:i.sourceMap,srcPath:path.resolve(process.cwd(),e),error:void 0}}catch(e){return console.error(`
|
|
10
10
|
compile() » ERROR: ${e.message}
|
|
11
|
-
`),{
|
|
11
|
+
`),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}else{o.verbose&&console.info("compile() » Compiling passed source code...");try{var n=sass.compileString(e,c);return{code:n.css,srcMap:n.sourceMap,srcPath:void 0,error:void 0}}catch(e){return console.error(`
|
|
12
|
+
compile() » ERROR: ${e.message}
|
|
13
|
+
`),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}}}function validateOptions(e,s,o,r){const i=JSON.stringify(s,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),n=Object.keys(s).join(", "),c=Object.keys(s).filter(e=>"boolean"==typeof s[e]),t=Object.keys(s).filter(e=>Number.isInteger(s[e]));let l="validateOptions() » ";try{l=validateOptions.caller?.name+"() » "}catch(e){}var a=r.split(",").findIndex(e=>e.trim().startsWith("{"))+1,p=(a+=["st","nd","rd"][a-1]||"th",()=>{console.info(`${l}Valid options: [ ${n} ]`),console.info(l+"If omitted, default settings are: "+i)}),d=()=>{console.info(l+"For more help, please visit "+o)};if("object"!=typeof e)return console.error(l+`ERROR: ${"0th"==a?"[O":a+" arg [o"}ptions] can only be an object of key/values.`),console.info(l+"Example valid call: "+r),p(),d(),!1;for(const f in e){if("isRecursing"!=f&&!Object.prototype.hasOwnProperty.call(s,f))return console.error(`${l}ERROR: \`${f}\` is an invalid option.`),p(),d(),!1;if(c.includes(f)&&"boolean"!=typeof e[f])return console.error(`${l}ERROR: [${f}] option can only be \`true\` or \`false\`.`),d(),!1;if(t.includes(f)&&(e[f]=parseInt(e[f],10),isNaN(e[f])||e[f]<1))return console.error(`${l}ERROR: [${f}] option can only be an integer > 0.`),d(),!1}return!0}const funcAliases={compile:["minify"],findSCSS:["find","findScss","findscss","search"]};module.exports={compile:compile,findSCSS:findSCSS};for(const Q in funcAliases)funcAliases[Q].forEach(e=>module.exports[e]=module.exports[Q]);
|
package/docs/README.md
CHANGED
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
<img height=14 src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/earth-icon/black/icon32.svg">
|
|
7
7
|
</picture>
|
|
8
8
|
English |
|
|
9
|
-
<a href="https://github.com/adamlui/
|
|
10
|
-
<a href="https://github.com/adamlui/
|
|
11
|
-
<a href="https://github.com/adamlui/
|
|
12
|
-
<a href="https://github.com/adamlui/
|
|
13
|
-
<a href="https://github.com/adamlui/
|
|
14
|
-
<a href="https://github.com/adamlui/
|
|
15
|
-
<a href="https://github.com/adamlui/
|
|
16
|
-
<a href="https://github.com/adamlui/
|
|
17
|
-
<a href="https://github.com/adamlui/
|
|
18
|
-
<a href="https://github.com/adamlui/
|
|
19
|
-
<a href="https://github.com/adamlui/
|
|
20
|
-
<a href="https://github.com/adamlui/
|
|
21
|
-
<a href="https://github.com/adamlui/
|
|
9
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/zh-cn#readme">简体中文</a> |
|
|
10
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/zh-tw#readme">繁體中文</a> |
|
|
11
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/ja#readme">日本語</a> |
|
|
12
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/hi#readme">हिंदी</a> |
|
|
13
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/bn#readme">বাংলা</a> |
|
|
14
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/mr#readme">मराठी</a> |
|
|
15
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/pa#readme">ਪੰਜਾਬੀ</a> |
|
|
16
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/de#readme">Deutsch</a> |
|
|
17
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/es#readme">Español</a> |
|
|
18
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/fr#readme">Français</a> |
|
|
19
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/it#readme">Italiano</a> |
|
|
20
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/nl#readme">Nederlands</a> |
|
|
21
|
+
<a href="https://github.com/adamlui/scss-to-css/tree/main/node.js/docs/pt#readme">Português</a>
|
|
22
22
|
</h6>
|
|
23
23
|
</td>
|
|
24
24
|
</table>
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
|
|
30
30
|
<a href="https://www.npmjs.com/package/@adamlui/scss-to-css"><img height=31 src="https://img.shields.io/npm/dm/%40adamlui%2Fscss-to-css?logo=npm&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
31
31
|
<a href="#%EF%B8%8F-mit-license"><img height=31 src="https://img.shields.io/badge/License-MIT-orange.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
32
|
-
<a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.
|
|
32
|
+
<a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.8.0"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.8.0-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
33
33
|
<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>
|
|
34
|
-
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=
|
|
34
|
+
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_scss-to-css:node.js/src/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_scss-to-css%3Anode.js%2Fsrc%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>
|
|
35
35
|
<a href="https://github.com/toolleeo/cli-apps#conversion"><img height=31 src="https://img.shields.io/badge/Mentioned_in-Awesome-c4a2bd?logo=awesomelists&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
36
36
|
|
|
37
37
|
<img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
|
|
@@ -70,7 +70,7 @@ $ scss-to-css
|
|
|
70
70
|
|
|
71
71
|
Sample output:
|
|
72
72
|
|
|
73
|
-
<img src="https://
|
|
73
|
+
<img src="https://raw.githubusercontent.com/adamlui/scss-to-css/main/node.js/media/images/screenshots/cli-scss-to-css-docs.png">
|
|
74
74
|
|
|
75
75
|
**💡 Note:** Source maps are also generated by default unless `-S` or `--no-source-maps` is passed.
|
|
76
76
|
|
|
@@ -172,20 +172,23 @@ const scssToCSS = require('@adamlui/scss-to-css');
|
|
|
172
172
|
|
|
173
173
|
#
|
|
174
174
|
|
|
175
|
-
### `compile(
|
|
175
|
+
### `compile(input[, options])`
|
|
176
176
|
|
|
177
|
-
Compiles SCSS
|
|
177
|
+
Compiles SCSS based on the string input supplied.
|
|
178
178
|
|
|
179
|
-
If
|
|
179
|
+
If **source code** is passed, it is directly compiled, then an object containing `srcPath` + `code` + `srcMap` + `error` is returned:
|
|
180
180
|
|
|
181
181
|
```js
|
|
182
|
-
const
|
|
182
|
+
const srcCode = 'h1 { font-size: 40px ; code { font-face: Roboto Mono }}',
|
|
183
|
+
compileResult = scssToCSS.compile(srcCode);
|
|
183
184
|
|
|
184
185
|
console.log(compileResult.error); // outputs runtime error, or `undefined` if no error
|
|
185
|
-
console.log(compileResult.code); // outputs
|
|
186
|
+
console.log(compileResult.code); // outputs minified CSS: 'h1{font-size:40px}h1 code{font-face:Roboto Mono}'
|
|
186
187
|
```
|
|
187
188
|
|
|
188
|
-
If a **
|
|
189
|
+
If a **file path** is passed, the file's code is loaded then compiled to CSS, returning an object like above.
|
|
190
|
+
|
|
191
|
+
If a **directory path** is passed, SCSS files are searched for (recursively by default), each one's code is loaded then compiled, then an array of objects containing `srcPath` + `code` + `srcMap` + `error` is returned:
|
|
189
192
|
|
|
190
193
|
```js
|
|
191
194
|
// Outputs paths to SCSS files in working directory + all nested directories
|
|
@@ -217,12 +220,12 @@ Name | Desciption | Default
|
|
|
217
220
|
|
|
218
221
|
### `findSCSS(searchDir[, options])`
|
|
219
222
|
|
|
220
|
-
Searches for all SCSS files within the `searchDir` string passed (useful for discovering what files [`compile()`](#
|
|
223
|
+
Searches for all SCSS files within the `searchDir` string passed (useful for discovering what files [`compile()`](#compileinput-options) will process) and returns an array containing their filepaths.
|
|
221
224
|
|
|
222
225
|
Options are boolean, passed as object properties. For example:
|
|
223
226
|
|
|
224
227
|
```js
|
|
225
|
-
// Search for SCSS files in exactly assets/scss
|
|
228
|
+
// Search for SCSS files in exactly assets/scss
|
|
226
229
|
const searchResults = scssToCSS.findSCSS('assets/scss', { recursive: false });
|
|
227
230
|
console.log(searchResults);
|
|
228
231
|
|
|
@@ -270,21 +273,21 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
270
273
|
|
|
271
274
|
> Recursively compress all images to WEBPs.
|
|
272
275
|
<br>[Download](https://raw.githubusercontent.com/adamlui/js-utils/main/img-to-webp/img-to-webp.js) /
|
|
273
|
-
[Discuss](https://js-utils.com/discussions)
|
|
276
|
+
[Discuss](https://github.js-utils.com/discussions)
|
|
274
277
|
|
|
275
|
-
### [</> minify.js](https://minify-js.org)
|
|
278
|
+
### [</> minify.js](https://minify-js.org) <a href="https://github.com/toolleeo/cli-apps#programming"><img height=18 src="https://awesome.re/mentioned-badge.svg"></a>
|
|
276
279
|
|
|
277
280
|
> Recursively minify all JavaScript files.
|
|
278
|
-
<br>[Install](https://
|
|
279
|
-
[Readme](
|
|
280
|
-
[CLI usage](
|
|
281
|
-
[API usage](
|
|
282
|
-
[Discuss](https://js-utils.com/discussions)
|
|
281
|
+
<br>[Install](https://node.minify-js.org/#-installation) /
|
|
282
|
+
[Readme](https://node.minify-js.org/#readme) /
|
|
283
|
+
[CLI usage](https://node.minify-js.org/#-command-line-usage) /
|
|
284
|
+
[API usage](https://node.minify-js.org/#-api-usage) /
|
|
285
|
+
[Discuss](https://github.js-utils.com/discussions)
|
|
283
286
|
|
|
284
287
|
<br>
|
|
285
288
|
|
|
286
289
|
<img height=6px width="100%" src="https://raw.githubusercontent.com/adamlui/js-utils/main/docs/images/aqua-separator.png">
|
|
287
290
|
|
|
288
291
|
<picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/adamlui/js-utils/main/media/images/icons/home/white/icon32x27.png"><img height=13 src="https://raw.githubusercontent.com/adamlui/js-utils/main/media/images/icons/home/dark-gray/icon32x27.png"></picture> <a href="https://js-utils.com">**More JavaScript utilities**</a> /
|
|
289
|
-
<a href="https://
|
|
292
|
+
<a href="https://github.com/adamlui/scss-to-css/discussions">Discuss</a> /
|
|
290
293
|
<a href="#--scss-to-css">Back to top ↑</a>
|
package/docs/SECURITY.md
CHANGED
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
# 🛡️ Security Policy
|
|
25
25
|
|
|
26
|
-
If you find a vulnerability, please open a [draft security advisory](https://github.com/adamlui/
|
|
26
|
+
If you find a vulnerability, please open a [draft security advisory](https://github.com/adamlui/scss-to-css/security/advisories/new).
|
|
27
27
|
|
|
28
28
|
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,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamlui/scss-to-css",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Recursively compile all SCSS files into minified CSS",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Adam Lui",
|
|
7
7
|
"email": "adam@kudoai.com",
|
|
8
8
|
"url": "https://github.com/adamlui"
|
|
9
9
|
},
|
|
10
|
-
"homepage": "https://
|
|
10
|
+
"homepage": "https://github.com/adamlui/scss-to-css/#readme",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"main": "dist/scss-to-css.min.js",
|
|
13
13
|
"files": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"repository": {
|
|
37
37
|
"type": "git",
|
|
38
|
-
"url": "git+https://github.com/adamlui/
|
|
38
|
+
"url": "git+https://github.com/adamlui/scss-to-css.git"
|
|
39
39
|
},
|
|
40
40
|
"keywords": [
|
|
41
41
|
"scss",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"stylesheets"
|
|
49
49
|
],
|
|
50
50
|
"bugs": {
|
|
51
|
-
"url": "https://
|
|
51
|
+
"url": "https://github.com/adamlui/scss-to-css/issues"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"sass": "^1.75.0"
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
"url": "https://github.com/sponsors/adamlui"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@adamlui/minify.js": "^1.5.
|
|
61
|
+
"@adamlui/minify.js": "^1.5.4"
|
|
62
62
|
}
|
|
63
63
|
}
|