@adamlui/scss-to-css 1.7.12 → 1.7.14
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 +1 -1
- package/dist/cli.min.js +3 -3
- package/dist/scss-to-css.min.js +4 -4
- package/docs/README.md +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
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.7.
|
|
32
|
+
<a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.7.14"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.7.14-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
34
|
<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>
|
|
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>
|
package/dist/cli.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* © 2024 Adam Lui & contributors under the MIT license.
|
|
4
|
-
* Source: https://
|
|
5
|
-
* Documentation: https://
|
|
4
|
+
* Source: https://code.js-utils.com/scss-to-css
|
|
5
|
+
* Documentation: https://docs.js-utils.com/scss-to-css
|
|
6
6
|
*/
|
|
7
|
-
const pkgName="@adamlui/scss-to-css",docURL="https://
|
|
7
|
+
const pkgName="@adamlui/scss-to-css",docURL="https://docs.js-utils.com/scss-to-css/#-command-line-usage",scssToCSS=require(__dirname.match(/src/)?"./scss-to-css":"./scss-to-css.min"),fs=require("fs"),path=require("path"),execSync=require("child_process")["execSync"],nc="[0m",br="[1;91m",by="[1;33m",bg="[1;92m",config={},argRegex={dryRun:/^--?(?:n|dry-?run)$/,includeDotFolders:/^--?(?:dd?|(?:include-?)?dot-?(?:folder|dir(?:ector(?:y|ie))?)s?=?(?:true|1)?)$/,noSourceMaps:/^--?(?:S|(?:exclude|disable|no)-?so?u?rce?-?maps?|so?u?rce?-?maps?=(?:false|0))$/,noRecursion:/^--?(?:R|(?:disable|no)-?recursi(?:on|ve)|recursi(?:on|ve)=(?:false|0))$/,noMinify:/^--?(?:M|(?:disable|no)-?minif(?:y|ication)|minif(?:y|ication)=(?:false|0))$/,quietMode:/^--?q(?:uiet)?(?:-?mode)?$/,help:/^--?h(?:elp)?$/,version:/^--?ve?r?s?i?o?n?$/};if(process.argv.forEach(s=>{var e;s.startsWith("-")&&((e=Object.keys(argRegex).find(e=>argRegex[e].test(s)))?config[e]=!0:(console.error(`
|
|
8
8
|
${br}ERROR: Arg [${s}] not recognized.`+nc),console.info(`
|
|
9
9
|
${by}Valid arguments are below.`+nc),printHelpSections(["configOptions","infoCmds"]),printHelpCmdAndDocURL(),process.exit(1)))}),process.argv.some(e=>argRegex.help.test(e)))printHelpSections();else if(process.argv.some(e=>argRegex.version.test(e))){const f=execSync(`npm view ${pkgName} version`).toString().trim()||"none";let e,s=process.cwd();for(;"/"!=s;){const i=path.join(s,"package.json");if(fs.existsSync(i)){const j=require(i);e=(j.dependencies?.[pkgName]||j.devDependencies?.[pkgName])?.match(/(\d+\.\d+\.\d+)/)[0]||"none";break}s=path.dirname(s)}console.info(`
|
|
10
10
|
Global version: `+f),console.info("Local version: "+e)}else{const[k="",l=""]=process.argv.slice(2).filter(e=>!e.startsWith("-")).map(e=>e.replace(/^\/*/,"")),m=path.resolve(process.cwd(),k),n=(k&&!fs.existsSync(m)&&(console.error(`
|
package/dist/scss-to-css.min.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* © 2024 Adam Lui & contributors under the MIT license.
|
|
4
|
-
* Source: https://
|
|
5
|
-
* Documentation: https://
|
|
4
|
+
* Source: https://code.js-utils.com/scss-to-css
|
|
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://
|
|
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),t=[];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?t.push(...findSCSS(s,{...r,isRecursing:!0})):e.endsWith(".scss")&&t.push(s)}),!r.isRecursing&&r.verbose&&(console.info("findSCSS() » Search complete! "+(0==t.length?"No":t.length)+` file${0==t.length||1<t.length?"s":""} found.`),"compile"==findSCSS.caller.name||/cli(?:\.min)?\.js$/.test(require.main.filename)||console.info("findSCSS() » Check returned array.")),r.isRecursing||0<t.length?t:[]}}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/#compileinputpath-options",r={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0};if("string"!=typeof e)console.error("compile() » ERROR: 1st arg <inputPath> must be a string."),console.info("compile() » For more help, please visit "+s);else if(e=path.resolve(process.cwd(),e),fs.existsSync(e)){if(validateOptions(o,r,s,"compile('assets/scss', { recursive: false, minify: false })")){const n={style:(o={...r,...o}).minify?"compressed":"expanded",sourceMap:o.sourceMaps};if(fs.existsSync(e)){if(!e.endsWith(".scss"))return r=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,n);return{code:s.css,srcMap:s.sourceMap,srcPath:e}}catch(e){return console.error(`
|
|
8
8
|
compile() » ERROR: ${e.message}
|
|
9
9
|
`),{error:e}}}).filter(e=>!e.error),o.verbose&&(0<r.length?console.info("compile() » Compilation complete. Check returned object."):console.info("compile() » No SCSS files processed.")),r;o.verbose&&console.info(`compile() » Compiling ${e}...`);try{var i=sass.compile(e,n);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)}}catch(e){return console.error(`
|
|
10
10
|
compile() » ERROR: ${e.message}
|
|
11
|
-
`),{error:e}}}}}else console.error("compile() » ERROR: 1st arg <inputPath> must be an existing directory or file."),console.error(`compile() » ${e} does not exist.`),console.info("compile() » For more help, please visit "+s)}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(", "),t=Object.keys(s).filter(e=>"boolean"==typeof s[e]),c=Object.keys(s).filter(e=>Number.isInteger(s[e]))
|
|
11
|
+
`),{error:e}}}}}else console.error("compile() » ERROR: 1st arg <inputPath> must be an existing directory or file."),console.error(`compile() » ${e} does not exist.`),console.info("compile() » For more help, please visit "+s)}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(", "),t=Object.keys(s).filter(e=>"boolean"==typeof s[e]),c=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)}),f=()=>{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(),f(),!1;for(const d in e){if("isRecursing"!=d&&!Object.prototype.hasOwnProperty.call(s,d))return console.error(`${l}ERROR: \`${d}\` is an invalid option.`),p(),f(),!1;if(t.includes(d)&&"boolean"!=typeof e[d])return console.error(`${l}ERROR: [${d}] option can only be \`true\` or \`false\`.`),f(),!1;if(c.includes(d)&&(e[d]=parseInt(e[d],10),isNaN(e[d])||e[d]<1))return console.error(`${l}ERROR: [${d}] option can only be an integer > 0.`),f(),!1}return!0}const funcAliases={compile:["minify"],findSCSS:["find","findScss","findscss"]};module.exports={compile:compile,findSCSS:findSCSS};for(const O in funcAliases)funcAliases[O].forEach(e=>module.exports[e]=module.exports[O]);
|
package/docs/README.md
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
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.7.
|
|
32
|
+
<a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.7.14"><img height=31 src="https://img.shields.io/badge/Latest_Build-1.7.14-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
34
|
<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>
|
|
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>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamlui/scss-to-css",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.14",
|
|
4
4
|
"description": "Recursively compile all SCSS files into minified CSS",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Adam Lui",
|
|
@@ -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
|
}
|