@adamlui/scss-to-css 1.7.6 → 1.7.7
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 +4 -2
- package/dist/cli.min.js +2 -2
- package/dist/scss-to-css.min.js +3 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
<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&color=af68ff&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
30
30
|
<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>
|
|
31
|
-
<a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.7.
|
|
31
|
+
<a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.7.7"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.7.7-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
|
|
32
32
|
<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>
|
|
33
33
|
<a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_js-utils:scss-to-css/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_js-utils%3Ascss-to-css%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>
|
|
34
34
|
|
|
@@ -154,7 +154,7 @@ Info commands:
|
|
|
154
154
|
|
|
155
155
|
You can also import **scss-to-css** into your app to use its API methods, both as an ECMAScript module or a CommonJS module.
|
|
156
156
|
|
|
157
|
-
#### ESM
|
|
157
|
+
#### ESM*:
|
|
158
158
|
|
|
159
159
|
```js
|
|
160
160
|
import * as scssToCSS from '@adamlui/scss-to-css';
|
|
@@ -166,6 +166,8 @@ import * as scssToCSS from '@adamlui/scss-to-css';
|
|
|
166
166
|
const scssToCSS = require('@adamlui/scss-to-css');
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
+
###### _*Node.js version 14 or higher required_
|
|
170
|
+
|
|
169
171
|
#
|
|
170
172
|
|
|
171
173
|
### `compile(inputPath[, options])`
|
package/dist/cli.min.js
CHANGED
|
@@ -6,10 +6,10 @@ ${t}Error: First argument can only be an existing file or directory.`+`
|
|
|
6
6
|
'${p}' does not exist.`+i+`
|
|
7
7
|
|
|
8
8
|
${e}Example valid command:
|
|
9
|
-
|
|
9
|
+
» scss-to-css . output.min.css`+i+`
|
|
10
10
|
|
|
11
11
|
${c}For all command options:
|
|
12
|
-
|
|
12
|
+
» scss-to-css --help`+i),process.exit(1)),f.endsWith(".scss")?[p]:o.findSCSS(p,{recursive:!l.noRecursion,verbose:!l.quietMode}));if(l.dryRun)0<m.length?(console.info(`
|
|
13
13
|
${c}SCSS files to be compiled:`+i),m.forEach(e=>console.info(e))):console.info(c+`
|
|
14
14
|
No SCSS files will be compiled.`+i);else{const h=[],g=m.map(e=>{var s=o.compile(e,{minify:!l.noMinify,sourceMaps:!l.noSourceMaps,verbose:!l.quietMode});return s.error&&h.push(e),s}).filter(e=>!e.error);if(g?.forEach(({code:e,srcMap:s,srcPath:o})=>{var i=n.join(n.dirname(o),/(?:src|s[ac]ss)$/.test(n.dirname(o))?"../css":u.endsWith(".css")?n.dirname(u):u||"css"),o=(u.endsWith(".css")&&f.endsWith(".scss")?n.basename(u).replace(/(\.min)?\.css$/,""):n.basename(o,".scss"))+".min.css",o=n.join(i,o);r.existsSync(i)||r.mkdirSync(i,{recursive:!0}),r.writeFileSync(o,e,"utf8"),l.noSourceMaps||r.writeFileSync(o+".map",JSON.stringify(s),"utf8")}),0<g?.length){const S=1<g.length?"s":"";s(`
|
|
15
15
|
${e}Compilation complete!`+i),s(g.length+" CSS file"+S+(l.noSourceMaps?"":` + ${g.length} source map`+S)+" generated.")}else s(c+"No SCSS files processed."+i);0<h.length&&(s(`
|
package/dist/scss-to-css.min.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
`+`findSCSS() » Valid options: [ ${Object.keys(e).join(", ")} ]`);if("boolean"!=typeof s[t])return console.error(`findSCSS() » ERROR: [${t}] option can only be set to \`true\` or \`false\`.`)}const i=c.readdirSync(o),n=[];return s.verbose&&!s.isRecursing&&console.info("\nfindSCSS() » Searching for SCSS files..."),i.forEach(e=>{var r=l.resolve(o,e);c.statSync(r).isDirectory()&&"node_modules"!=e&&(s.dotFolders||!e.startsWith("."))&&s.recursive?n.push(...a(r,{...s,isRecursing:!0})):e.endsWith(".scss")&&n.push(r)}),!s.isRecursing&&s.verbose&&console.info("findSCSS() » Search complete! "+(0===n.length?"No":n.length)+` file${1<n.length?"s":""} found.`+("compile"===a.caller.name||require.main.filename.endsWith("cli.js")?"":"\nfindSCSS() » Check returned array.")),s.isRecursing||0<n.length?n:[]}function e(e,o={}){var r={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0};if(o={...r,...o},"string"!=typeof e)return console.error("compile() » ERROR: 1st arg <inputPath> must be a string.");if(e=l.resolve(process.cwd(),e),!c.existsSync(e))return console.error("compile() » ERROR: 1st arg <inputPath> must be an existing directory or file.\n"+`compile() » ${e} does not exist.`);for(const n in o){if(!Object.prototype.hasOwnProperty.call(r,n))return console.error(`compile() » ERROR: \`${n}\` is an invalid option.
|
|
3
|
-
`+`compile() » Valid options: [ ${Object.keys(r).join(", ")} ]`);if("boolean"!=typeof o[n])return console.error(`compile() » ERROR: [${n}] option can only be set to \`true\` or \`false\`.`)}const s={style:o.minify?"compressed":"expanded",sourceMap:o.sourceMaps};if(c.existsSync(e)){if(!e.endsWith(".scss"))return a(e,{recursive:o.recursive,verbose:o.verbose,dotFolders:o.dotFolders})?.map(e=>{o.verbose&&console.info(`compile() » Compiling ${e}...`);try{var r=t.compile(e,s);return{code:r.css,srcMap:r.sourceMap,srcPath:e}}catch(e){return console.error(`
|
|
1
|
+
const f=require("fs"),p=require("path"),a=require("sass");function d(r,s={}){var e={recursive:!0,verbose:!0,dotFolders:!1};if("string"!=typeof r)return console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string.");var o=p.resolve(process.cwd(),r);if(f.existsSync(o)){const i=JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),c=Object.keys(e).join(", ");var n=()=>{console.info(`findSCSS() » Valid options: [ ${c} ]`),console.info("findSCSS() » If omitted, default settings are: "+i)};if("object"==typeof s){for(const a in s){if(!Object.prototype.hasOwnProperty.call(e,a)&&"isRecursing"!==a)return console.error(`findSCSS() » ERROR: \`${a}\` is an invalid option.`),void n();if("boolean"!=typeof s[a])return console.error(`findSCSS() » ERROR: [${a}] option can only be \`true\` or \`false\`.`)}s={...e,...s};const t=f.readdirSync(r),l=[];return s.verbose&&!s.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),t.forEach(e=>{var o=p.resolve(r,e);f.statSync(o).isDirectory()&&"node_modules"!=e&&(s.dotFolders||!e.startsWith("."))&&s.recursive?l.push(...d(o,{...s,isRecursing:!0})):e.endsWith(".scss")&&l.push(o)}),!s.isRecursing&&s.verbose&&(console.info("findSCSS() » Search complete! "+(0===l.length?"No":l.length)+` file${1<l.length?"s":""} found.`),"compile"===d.caller.name||require.main.filename.endsWith("cli.js")||console.info("findSCSS() » Check returned array.")),s.isRecursing||0<l.length?l:[]}console.error("findSCSS() » ERROR: 2nd arg [options] can only be an object of key/values."),console.info("findSCSS() » Example valid call: findSCSS('assets/scss', { verbose: false, dotFolders: true })"),n()}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${o} does not exist.`)}function e(e,r={}){var o={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0};if("string"!=typeof e)return console.error("compile() » ERROR: 1st arg <inputPath> must be a string.");if(e=p.resolve(process.cwd(),e),f.existsSync(e)){const i=JSON.stringify(o,null,2).replace(/"([^"]+)":/g,"$1:").replace(/"/g,"'").replace(/\n\s*/g," "),c=Object.keys(o).join(", ");var s=()=>{console.info(`compile() » Valid options: [ ${c} ]`),console.info("compile() » If omitted, default settings are: "+i)};if("object"!=typeof r)console.error("compile() » ERROR: 2nd [options] can only be an object of key/values."),console.info("compile() » Example valid call: compile('assets/scss', { recursive: false, minify: false })"),s();else{for(const l in r){if(!Object.prototype.hasOwnProperty.call(o,l))return console.error(`compile() » ERROR: \`${l}\` is an invalid option.`),void s();if("boolean"!=typeof r[l])return console.error(`compile() » ERROR: [${l}] option can only be \`true\` or \`false\`.`)}const t={style:(r={...o,...r}).minify?"compressed":"expanded",sourceMap:r.sourceMaps};if(f.existsSync(e)){if(!e.endsWith(".scss"))return d(e,{recursive:r.recursive,verbose:r.verbose,dotFolders:r.dotFolders})?.map(e=>{r.verbose&&console.info(`compile() » Compiling ${e}...`);try{var o=a.compile(e,t);return{code:o.css,srcMap:o.sourceMap,srcPath:e}}catch(e){return console.error(`
|
|
4
2
|
compile() » ERROR: ${e.message}
|
|
5
|
-
`),{error:e}}}).filter(e=>!e.error);
|
|
3
|
+
`),{error:e}}}).filter(e=>!e.error);r.verbose&&console.info(`compile() » Compiling ${e}...`);try{var n=a.compile(e,t);return{code:n.css,srcMap:n.sourceMap,srcPath:p.resolve(process.cwd(),e)}}catch(e){return console.error(`
|
|
6
4
|
compile() » ERROR: ${e.message}
|
|
7
|
-
`),{error:e}}}}module.exports={compile:e,findSCSS:
|
|
5
|
+
`),{error:e}}}}}else console.error("compile() » ERROR: 1st arg <inputPath> must be an existing directory or file."),console.error(`compile() » ${e} does not exist.`)}module.exports={compile:e,findSCSS:d};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamlui/scss-to-css",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
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://js-utils.com/scss-to-css",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"main": "dist/scss-to-css.min.js",
|
|
13
13
|
"files": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"stylesheets"
|
|
49
49
|
],
|
|
50
50
|
"bugs": {
|
|
51
|
-
"url": "https://
|
|
51
|
+
"url": "https://js-utils.com/issues"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"sass": "^1.72.0"
|