@adamlui/scss-to-css 1.11.0 → 1.12.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 CHANGED
@@ -31,8 +31,8 @@
31
31
  <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>
32
32
  <a href="#%EF%B8%8F-mit-license">
33
33
  <img height=31 src="https://img.shields.io/badge/License-MIT-fc4f2d.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
34
- <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.11.0">
35
- <img height=31 src="https://img.shields.io/badge/Latest_Build-1.11.0-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
34
+ <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.12.0">
35
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-1.12.0-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
36
36
  <a href="https://www.npmjs.com/package/@adamlui/scss-to-css?activeTab=code">
37
37
  <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>
38
38
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_scss-to-css:node.js/src/scss-to-css.js">
@@ -149,6 +149,7 @@ Boolean options:
149
149
  -S, --no-source-maps Prevent source maps from being generated.
150
150
  -M, --no-minify Disable minification of output CSS.
151
151
  -R, --no-recursion Disable recursive file searching.
152
+ -C, --clone-folders Preserve folder structure in output directory
152
153
  -c, --copy Copy compiled CSS to clipboard instead of
153
154
  writing to file if single source file is
154
155
  processed.
@@ -225,15 +226,16 @@ scssToCSS.compile(inputDir, { minify: false });
225
226
 
226
227
  Available parameters (and their default settings) are:
227
228
 
228
- Name | Type | Desciption | Default value
229
- --------------|---------|-------------------------------------------------------------------------|---------------
230
- `recursive` | Boolean | Recursively search for nested files if dir path passed. | `true`
231
- `verbose` | Boolean | Show logging in console/terminal. | `true`
232
- `dotFolders` | Boolean | Include dotfolders in file search. | `false`
233
- `minify` | Boolean | Minify output CSS. | `true`
234
- `sourceMaps` | Boolean | Generate CSS source maps. | `true`
235
- `ignoreFiles` | Array | Files (by name) to exclude from compilation. | `[]`
236
- `comment` | String | Header comment to prepend to compiled CSS. Separate by line using '\n'. | `''`
229
+ Name | Type | Desciption | Default value
230
+ ---------------|---------|-------------------------------------------------------------------------|---------------
231
+ `recursive` | Boolean | Recursively search for nested files if dir path passed. | `true`
232
+ `verbose` | Boolean | Show logging in console/terminal. | `true`
233
+ `dotFolders` | Boolean | Include dotfolders in file search. | `false`
234
+ `minify` | Boolean | Minify output CSS. | `true`
235
+ `sourceMaps` | Boolean | Generate CSS source maps. | `true`
236
+ `cloneFolders` | Boolean | Preserve folder structure in output dir | `false`
237
+ `ignoreFiles` | Array | Files (by name) to exclude from compilation. | `[]`
238
+ `comment` | String | Header comment to prepend to compiled CSS. Separate by line using '\n'. | `''`
237
239
 
238
240
  #
239
241
 
package/dist/cli.min.js CHANGED
@@ -4,27 +4,27 @@
4
4
  * Source: https://code.scsstocss.org/node.js
5
5
  * Documentation: https://docs.scsstocss.org/node.js
6
6
  */
7
- (()=>{let i="@adamlui/scss-to-css",r="https://docs.scsstocss.org/node.js/#-command-line-usage",t=require(__dirname.match(/src/)?"./scss-to-css":"./scss-to-css.min"),c=require("fs"),l=require("path"),s=require("node-clipboardy"),o=require("child_process").execSync,a="",m="",p="",d="",f="",u={},n={flags:{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))$/,copy:/^--?c(?:opy)?$/,quietMode:/^--?q(?:uiet)?(?:-?mode)?$/},paramOptions:{ignoreFiles:/^--?(?:ignore|skip|exclude)(?:d?-?files?)?(?:=.*|$)/,comment:/^--?comments?(?:=.*|$)/},infoCmds:{help:/^--?h(?:elp)?$/,version:/^--?ve?r?s?i?o?n?$/}};if(process.argv.forEach(s=>{var e,o,i;s.startsWith("-")&&(i=Object.keys(n.flags).find(e=>n.flags[e].test(s)),e=Object.keys(n.paramOptions).find(e=>n.paramOptions[e].test(s)),o=Object.keys(n.infoCmds).find(e=>n.infoCmds[e].test(s)),i?u[i]=!0:e?(/=.+/.test(s)||(console.error(`
8
- ${m}ERROR: Arg [--${s.replace(/-/g,"")}] requires '=' followed by a value.`),v(),process.exit(1)),i=s.split("=")[1],u[e]=parseInt(i)||i):o||(console.error(`
9
- ${m}ERROR: Arg [${s}] not recognized.`),console.info(`
10
- ${p}Valid arguments are below.`),y(["flags","paramOptions","infoCmds"]),process.exit(1)))}),process.argv.some(e=>n.infoCmds.help.test(e)))y();else if(process.argv.some(e=>n.infoCmds.version.test(e))){var h=o(`npm view ${i} version`).toString().trim()||"none";let e,s=process.cwd();for(;"/"!=s;){var g=l.join(s,"package.json");if(c.existsSync(g)){g=require(g);e=(g.dependencies?.[i]||g.devDependencies?.[i])?.match(/(\d+\.\d+\.\d+)/)[0]||"none";break}s=l.dirname(s)}console.info(`
11
- Global version: `+h),console.info("Local version: "+e)}else{let[r="",n=""]=process.argv.slice(2).filter(e=>!e.startsWith("-")).map(e=>e.replace(/^\/*/,"")),e=l.resolve(process.cwd(),r);r&&!c.existsSync(e)&&(h=e+".scss",c.existsSync(h)?e=h:(console.error(`
12
- ${m}Error: First argument can only be an existing file or directory.`+`
13
- '${e}' does not exist.`),console.info(`
14
- ${d}Example valid command:
15
- » scss-to-css . output.min.css`),v(),process.exit(1)));h=e.endsWith(".scss")&&!c.statSync(e).isDirectory()?[e]:t.findSCSS(e,{recursive:!u.noRecursion,verbose:!u.quietMode,ignoreFiles:(u.ignoreFiles?.split(",")??[]).map(e=>e.trim())});if(u.dryRun)h.length?(console.info(`
16
- ${p}SCSS files to be compiled:`),h.forEach(e=>console.info(e))):console.info(p+`
17
- No SCSS files will be compiled.`);else{let o=[];var S,h=h.map(e=>{var s=t.compile(e,{verbose:!u.quietMode,minify:!u.noMinify,sourceMaps:!u.noSourceMaps,comment:u.comment?.replace(/\\n/g,"\n")});return s.error&&o.push(e),s}).filter(e=>!e.error);h?.length?(S=1<h.length?"s":"",$(`
18
- ${d}Compilation complete!`),$(f+h.length+" CSS file"+S+(u.noSourceMaps?"":` + ${h.length} source map`+S)+" generated."+a)):$(`
19
- ${p}No SCSS files processed.`),o.length&&($(`
20
- `+m+o.length+" file"+(1<o.length?"s":"")+" failed to compile:"),o.forEach(e=>$(e))),0==h?.length&&process.exit(0),u.copy&&1==h?.length?(console.log(`
21
- `+f+h[0].code+a),$("\nCopying to clipboard..."),s.writeSync(h[0].code)):($(`
22
- Writing to file${1<h?.length?"s":""}...`),h?.forEach(({code:e,srcMap:s,srcPath:o})=>{var i=l.join(l.dirname(o),/(?:src|s[ac]ss)$/.test(l.dirname(o))?"../"+(n||"css"):n.endsWith(".css")?l.dirname(n):n||"css"),o=(n.endsWith(".css")&&r.endsWith(".scss")?l.basename(n).replace(/(\.min)?\.css$/,""):l.basename(o,".scss"))+".min.css",o=l.join(i,o);c.existsSync(i)||c.mkdirSync(i,{recursive:!0}),c.writeFileSync(o,e,"utf8"),u.noSourceMaps||c.writeFileSync(o+".map",JSON.stringify(s),"utf8")}))}}function y(e=["header","usage","pathArgs","flags","paramOptions","infoCmds"]){var s=` ${i.replace(/^@[^/]+\//,"")}  `;let o={header:[`
23
- ├ `+s+"© 2024–2025 Adam Lui & contributors under the MIT license.",s+"Source: https://code.scsstocss.org/node.js"],usage:[`
24
- ${f}o Usage:`,` ${f}» `+d+"scss-to-css [inputPath] [outputPath] [options]"+a],pathArgs:[`
25
- ${f}o Path arguments:`," [inputPath] Path to SCSS file or directory containing SCSS files to be compiled, relative to the current working directory."," [outputPath] Path to file or directory where CSS + sourcemap files will be stored, relative to original file location (if not provided, css/ is used)."],flags:[`
26
- ${f}o Boolean options:`," -n, --dry-run Don't actually compile the file(s), just show if they will be processed."," -d, --include-dotfolders Include dotfolders in file search."," -S, --no-source-maps Prevent source maps from being generated."," -M, --no-minify Disable minification of output CSS."," -R, --no-recursion Disable recursive file searching."," -c, --copy Copy compiled CSS to clipboard instead of writing to file if single source file is processed."," -q, --quiet Suppress all logging except errors."],paramOptions:[`
27
- ${f}o Parameter options:`,'--ignore-files="file1.scss,file2.scss" Files to exclude from compilation.',"--comment=\"comment\" Prepend header comment to compiled CSS. Separate by line using '\\n'."],infoCmds:[`
28
- ${f}o Info commands:`," -h, --help Display help screen."," -v, --version Show version number."]};e.forEach(t=>o[t]?.forEach(s=>{{var n=/header|usage/.test(t)?1:41;let o=process.stdout.columns||80,i=[],e=s.match(/\S+|\s+/g),r="";e.forEach(e=>{var s=o-(i.length?n:0);r.length+"| ".length+e.length>s&&(i.push(i.length?r.trimStart():r),r=""),r+=e}),i.push(i.length?r.trimStart():r),i.forEach((e,s)=>console.info("| "+(0==s?e:" ".repeat(n)+e)))}})),console.info("\nFor more help, please visit: "+f+r+a)}function v(){console.info(`
7
+ (()=>{let i="@adamlui/scss-to-css",r="https://docs.scsstocss.org/node.js/#-command-line-usage",n=require(__dirname.match(/src/)?"./scss-to-css":"./scss-to-css.min"),a=require("fs"),m=require("path"),t=require("node-clipboardy"),o=require("child_process").execSync,d="",p="",f="",u="",h="",g={},c={flags:{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))$/,cloneFolders:/^--?(?:C|clone-?folders?=?(?:true|1)?)$/,copy:/^--?c(?:opy)?$/,quietMode:/^--?q(?:uiet)?(?:-?mode)?$/},paramOptions:{ignoreFiles:/^--?(?:ignore|skip|exclude)(?:d?-?files?)?(?:=.*|$)/,comment:/^--?comments?(?:=.*|$)/},infoCmds:{help:/^--?h(?:elp)?$/,version:/^--?ve?r?s?i?o?n?$/}};if(process.argv.forEach(s=>{var e,o,i;s.startsWith("-")&&(i=Object.keys(c.flags).find(e=>c.flags[e].test(s)),e=Object.keys(c.paramOptions).find(e=>c.paramOptions[e].test(s)),o=Object.keys(c.infoCmds).find(e=>c.infoCmds[e].test(s)),i?g[i]=!0:e?(/=.+/.test(s)||(console.error(`
8
+ ${p}ERROR: Arg [--${s.replace(/-/g,"")}] requires '=' followed by a value.`),$(),process.exit(1)),i=s.split("=")[1],g[e]=parseInt(i)||i):o||(console.error(`
9
+ ${p}ERROR: Arg [${s}] not recognized.`),console.info(`
10
+ ${f}Valid arguments are below.`),v(["flags","paramOptions","infoCmds"]),process.exit(1)))}),process.argv.some(e=>c.infoCmds.help.test(e)))v();else if(process.argv.some(e=>c.infoCmds.version.test(e))){var S=o(`npm view ${i} version`).toString().trim()||"none";let e,s=process.cwd();for(;"/"!=s;){var l=m.join(s,"package.json");if(a.existsSync(l)){l=require(l);e=(l.dependencies?.[i]||l.devDependencies?.[i])?.match(/(\d+\.\d+\.\d+)/)[0]||"none";break}s=m.dirname(s)}console.info(`
11
+ Global version: `+S),console.info("Local version: "+e)}else{let[c="",l=""]=process.argv.slice(2).filter(e=>!e.startsWith("-")).map(e=>e.replace(/^\/*/,"")),s=m.resolve(process.cwd(),c);c&&!a.existsSync(s)&&(S=s+".scss",a.existsSync(S)?s=S:(console.error(`
12
+ ${p}Error: First argument can only be an existing file or directory.`+`
13
+ '${s}' does not exist.`),console.info(`
14
+ ${u}Example valid command:
15
+ » scss-to-css . output.min.css`),$(),process.exit(1)));var y,S=s.endsWith(".scss")&&!a.statSync(s).isDirectory()?[s]:n.findSCSS(s,{recursive:!g.noRecursion,verbose:!g.quietMode,ignoreFiles:(g.ignoreFiles?.split(",")??[]).map(e=>e.trim())});if(g.dryRun)S.length?(console.info(`
16
+ ${f}SCSS files to be compiled:`),S.forEach(e=>console.info(e))):console.info(f+`
17
+ No SCSS files will be compiled.`);else{let o=[],e=[];g.cloneFolders&&a.statSync(s).isDirectory()?(y=n.compile(s,{verbose:!g.quietMode,minify:!g.noMinify,comment:g.comment?.replace(/\\n/g,"\n"),cloneFolders:!0,recursive:!g.noRecursion,dotFolders:!!g.includeDotFolders,sourceMaps:!g.noSourceMaps,ignoreFiles:g.ignoreFiles?g.ignoreFiles.split(",").map(e=>e.trim()):[]}),Array.isArray(y)?e=y:y&&y.error?o.push(s):y&&(e=[y])):e=S.map(e=>{var s=n.compile(e,{verbose:!g.quietMode,minify:!g.noMinify,sourceMaps:!g.noSourceMaps,comment:g.comment?.replace(/\\n/g,"\n")});return s.error&&o.push(e),s}).filter(e=>!e.error),e?.length?(y=1<e.length?"s":"",b(`
18
+ ${u}Compilation complete!`),b(h+e.length+" CSS file"+y+(g.noSourceMaps?"":` + ${e.length} source map`+y)+" generated."+d)):b(`
19
+ ${f}No SCSS files processed.`),o.length&&(b(`
20
+ `+p+o.length+" file"+(1<o.length?"s":"")+" failed to compile:"),o.forEach(e=>b(e))),0==e?.length&&process.exit(0),g.copy&&1==e?.length?(console.log(`
21
+ `+h+e[0].code+d),b("\nCopying to clipboard..."),t.writeSync(e[0].code)):(b(`
22
+ Writing to file${1<e?.length?"s":""}...`),e?.forEach(({code:e,srcMap:s,srcPath:o,relPath:i})=>{let r,n;if(g.cloneFolders&&i&&l){let e=m.resolve(process.cwd(),l),s=m.dirname(i);r="."!=s?m.join(e,s):e,n=m.basename(o,".scss")+`${g.noMinify?"":".min"}.css`}else r=m.join(m.dirname(o),/(?:src|s[ac]ss)$/.test(m.dirname(o))?"../"+(l||"css"):l.endsWith(".css")?m.dirname(l):l||"css"),n=(l.endsWith(".css")&&c.endsWith(".scss")?m.basename(l).replace(/(\.min)?\.css$/,""):m.basename(o,".scss"))+".min.css";let t=m.join(r,n);a.existsSync(r)||a.mkdirSync(r,{recursive:!0}),a.writeFileSync(t,e,"utf8"),b(` ${u}✓ `+m.relative(process.cwd(),t)),g.noSourceMaps||a.writeFileSync(t+".map",JSON.stringify(s),"utf8"),b(` ${u}✓ `+m.relative(process.cwd(),t))}))}}function v(e=["header","usage","pathArgs","flags","paramOptions","infoCmds"]){var s=` ${i.replace(/^@[^/]+\//,"")}  `;let o={header:[`
23
+ ├ `+s+"© 2024–2026 Adam Lui & contributors under the MIT license.",s+"Source: https://code.scsstocss.org/node.js"],usage:[`
24
+ ${h}o Usage:`,` ${h}» `+u+"scss-to-css [inputPath] [outputPath] [options]"+d],pathArgs:[`
25
+ ${h}o Path arguments:`," [inputPath] Path to SCSS file or directory containing SCSS files to be compiled, relative to the current working directory."," [outputPath] Path to file or directory where CSS + sourcemap files will be stored, relative to original file location (if not provided, css/ is used)."],flags:[`
26
+ ${h}o Boolean options:`," -n, --dry-run Don't actually compile the file(s), just show if they will be processed."," -d, --include-dotfolders Include dotfolders in file search."," -S, --no-source-maps Prevent source maps from being generated."," -M, --no-minify Disable minification of output CSS."," -R, --no-recursion Disable recursive file searching."," -C, --clone-folders Preserve folder structure in output directory."," -c, --copy Copy compiled CSS to clipboard instead of writing to file if single source file is processed."," -q, --quiet Suppress all logging except errors."],paramOptions:[`
27
+ ${h}o Parameter options:`,'--ignore-files="file1.scss,file2.scss" Files to exclude from compilation.',"--comment=\"comment\" Prepend header comment to compiled CSS. Separate by line using '\\n'."],infoCmds:[`
28
+ ${h}o Info commands:`," -h, --help Display help screen."," -v, --version Show version number."]};e.forEach(t=>o[t]?.forEach(s=>{{var n=/header|usage/.test(t)?1:41;let o=process.stdout.columns||80,i=[],e=s.match(/\S+|\s+/g),r="";e.forEach(e=>{var s=o-(i.length?n:0);r.length+"| ".length+e.length>s&&(i.push(i.length?r.trimStart():r),r=""),r+=e}),i.push(i.length?r.trimStart():r),i.forEach((e,s)=>console.info("| "+(0==s?e:" ".repeat(n)+e)))}})),console.info("\nFor more help, please visit: "+h+r+d)}function $(){console.info(`
29
29
  For more help, type 'scss-to-css --help' or visit
30
- `+f+r+a)}function $(e){u.quietMode||console.info(e)}})();
30
+ `+h+r+d)}function b(e){g.quietMode||console.info(e)}})();
@@ -1,8 +1,8 @@
1
- let fs=require("fs"),path=require("path"),sass=require("sass");function findSCSS(r,i={}){var e="https://docs.scsstocss.org/node.js/#findscsssearchdir-options",s={recursive:!0,verbose:!0,dotFolders:!1,ignoreFiles:[]};if("string"!=typeof r)console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string."),console.info("findSCSS() » For more help, please visit "+e);else{var o=path.resolve(process.cwd(),r);if(fs.existsSync(o)){if(validateOptions(i,s,e,"findSCSS('assets/scss', { verbose: false, dotFolders: true })")){i={...s,...i};let e=fs.readdirSync(r),o=[];return i.verbose&&!i.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),e.forEach(e=>{var s=path.resolve(r,e);fs.statSync(s).isDirectory()&&"node_modules"!=e&&i.recursive&&(i.dotFolders||!e.startsWith("."))?o.push(...findSCSS(s,{...i,isRecursing:!0})):e.endsWith(".scss")&&!i.ignoreFiles.includes(e)?o.push(s):i.verbose&&i.ignoreFiles.includes(e)&&console.info(`findSCSS() » ** ${e} ignored due to [options.ignoreFiles]`)}),i.verbose&&!i.isRecursing&&(console.info("findSCSS() » Search complete! "+(0==o.length?"No":o.length)+` file${1==o.length?"":"s"} found.`),"compile"!=findSCSS.caller.name)&&"undefined"!=typeof window&&console.info("findSCSS() » Check returned array."),i.isRecursing||o.length?o:[]}}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${o} does not exist.`),console.info("findSCSS() » For more help, please visit "+e)}}function compile(e,r={}){var s="https://docs.scsstocss.org/node.js/#compileinput-options",i={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0,ignoreFiles:[],comment:""};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(r,i,s,"compile('assets/scss', { recursive: false, minify: false })")){let o={style:(r={...i,...r}).minify?"compressed":"expanded",sourceMap:r.sourceMaps};if(fs.existsSync(e)){if(!e.endsWith(".scss"))return s=findSCSS(e,{recursive:r.recursive,verbose:r.verbose,dotFolders:r.dotFolders,ignoreFiles:r.ignoreFiles})?.map(e=>{r.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var s=sass.compile(e,o);return r.comment&&(s.css=t(s.css,r.comment)),{code:s.css,srcMap:s.sourceMap,srcPath:e,error:void 0}}catch(e){return console.error(`
1
+ let fs=require("fs"),path=require("path"),sass=require("sass");function findSCSS(r,i={}){var e="https://docs.scsstocss.org/node.js/#findscsssearchdir-options",s={recursive:!0,verbose:!0,dotFolders:!1,ignoreFiles:[]};if("string"!=typeof r)console.error("findSCSS() » ERROR: 1st arg <searchDir> must be a string."),console.info("findSCSS() » For more help, please visit "+e);else{var o=path.resolve(process.cwd(),r);if(fs.existsSync(o)){if(validateOptions(i,s,e,"findSCSS('assets/scss', { verbose: false, dotFolders: true })")){i={...s,...i};let e=fs.readdirSync(r),o=[];return i.verbose&&!i.isRecursing&&console.info("findSCSS() » Searching for SCSS files..."),e.forEach(e=>{var s=path.resolve(r,e);fs.statSync(s).isDirectory()&&"node_modules"!=e&&i.recursive&&(i.dotFolders||!e.startsWith("."))?o.push(...findSCSS(s,{...i,isRecursing:!0})):e.endsWith(".scss")&&!i.ignoreFiles.includes(e)?o.push(s):i.verbose&&i.ignoreFiles.includes(e)&&console.info(`findSCSS() » ** ${e} ignored due to [options.ignoreFiles]`)}),i.verbose&&!i.isRecursing&&(console.info("findSCSS() » Search complete! "+(0==o.length?"No":o.length)+` file${1==o.length?"":"s"} found.`),"compile"!=findSCSS.caller?.name)&&"undefined"!=typeof window&&console.info("findSCSS() » Check returned array."),i.isRecursing||o.length?o:[]}}else console.error("findSCSS() » ERROR: 1st arg <searchDir> must be an existing directory."),console.error(`findSCSS() » ${o} does not exist.`),console.info("findSCSS() » For more help, please visit "+e)}}function compile(i,n={}){var e="https://docs.scsstocss.org/node.js/#compileinput-options",s={recursive:!0,verbose:!0,dotFolders:!1,minify:!0,sourceMaps:!0,cloneFolders:!1,ignoreFiles:[],comment:""};if("string"!=typeof i)console.error("compile() » ERROR: 1st arg <input> must be a string."),console.info("compile() » For more help, please visit "+e);else if(validateOptions(n,s,e,"compile('assets/scss', { recursive: false, minify: false })")){let r={style:(n={...s,...n}).minify?"compressed":"expanded",sourceMap:n.sourceMaps,charset:!1};if(fs.existsSync(i)){if(!i.endsWith(".scss"))return e=findSCSS(i,{recursive:n.recursive,verbose:n.verbose,dotFolders:n.dotFolders,ignoreFiles:n.ignoreFiles})?.map(s=>{n.verbose&&console.info(`compile() » ** Compiling ${s}...`);try{var o=sass.compile(s,r);let e;return n.cloneFolders&&(e=path.relative(path.resolve(process.cwd(),i),s)),n.comment&&(o.css=t(o.css,n.comment)),{code:o.css,srcMap:o.sourceMap,srcPath:s,relPath:e,error:void 0}}catch(e){return console.error(`
2
2
  compile() » ERROR: ${e.message}
3
- `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}).filter(e=>!e.error),r.verbose&&(s.length&&"undefined"!=typeof window?console.info("compile() » Compilation complete! Check returned object."):console.info("compile() » No SCSS files processed.")),s;r.verbose&&console.info(`compile() » ** Compiling ${e}...`);try{var n=sass.compile(e,o);return r.comment&&(n.css=t(n.css,r.comment)),r.verbose&&"undefined"!=typeof window&&console.info("compile() » Compilation complete! Check returned object."),{code:n.css,srcMap:n.sourceMap,srcPath:path.resolve(process.cwd(),e),error:void 0}}catch(e){return console.error(`
3
+ `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}).filter(e=>!e.error),n.verbose&&(e.length&&"undefined"!=typeof window?console.info("compile() » Compilation complete! Check returned object."):console.info("compile() » No SCSS files processed.")),e;n.verbose&&console.info(`compile() » ** Compiling ${i}...`);try{var o=sass.compile(i,r);return n.comment&&(o.css=t(o.css,n.comment)),n.verbose&&"undefined"!=typeof window&&console.info("compile() » Compilation complete! Check returned object."),{code:o.css,srcMap:o.sourceMap,srcPath:path.resolve(process.cwd(),i),error:void 0}}catch(e){return console.error(`
4
4
  compile() » ERROR: ${e.message}
5
- `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}else{r.verbose&&console.info("compile() » ** Compiling passed source code...");try{var c=sass.compileString(e,o);return r.comment&&(c.css=t(c.css,r.comment)),{code:c.css,srcMap:c.sourceMap,srcPath:void 0,error:void 0}}catch(e){return console.error(`
5
+ `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}else{n.verbose&&console.info("compile() » ** Compiling passed source code...");try{var c=sass.compileString(i,r);return n.comment&&(c.css=t(c.css,n.comment)),{code:c.css,srcMap:c.sourceMap,srcPath:void 0,error:void 0}}catch(e){return console.error(`
6
6
  compile() » ERROR: ${e.message}
7
7
  `),{code:void 0,srcMap:void 0,srcPath:void 0,error:e}}}function t(e,s){var s=s.split("\n").map(e=>" * "+e).join("\n"),o=e.indexOf("#!");return 0<=o?(o=e.indexOf("\n",o)+1,e.slice(0,o)+`/**
8
8
  /**
package/docs/README.md CHANGED
@@ -31,8 +31,8 @@
31
31
  <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>
32
32
  <a href="#%EF%B8%8F-mit-license">
33
33
  <img height=31 src="https://img.shields.io/badge/License-MIT-fc4f2d.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
34
- <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.11.0">
35
- <img height=31 src="https://img.shields.io/badge/Latest_Build-1.11.0-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
34
+ <a href="https://github.com/adamlui/js-utils/releases/tag/scss-to-css-1.12.0">
35
+ <img height=31 src="https://img.shields.io/badge/Latest_Build-1.12.0-44cc11.svg?logo=icinga&logoColor=white&labelColor=464646&style=for-the-badge"></a>
36
36
  <a href="https://www.npmjs.com/package/@adamlui/scss-to-css?activeTab=code">
37
37
  <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>
38
38
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=adamlui_scss-to-css:node.js/src/scss-to-css.js">
@@ -149,6 +149,7 @@ Boolean options:
149
149
  -S, --no-source-maps Prevent source maps from being generated.
150
150
  -M, --no-minify Disable minification of output CSS.
151
151
  -R, --no-recursion Disable recursive file searching.
152
+ -C, --clone-folders Preserve folder structure in output directory
152
153
  -c, --copy Copy compiled CSS to clipboard instead of
153
154
  writing to file if single source file is
154
155
  processed.
@@ -225,15 +226,16 @@ scssToCSS.compile(inputDir, { minify: false });
225
226
 
226
227
  Available parameters (and their default settings) are:
227
228
 
228
- Name | Type | Desciption | Default value
229
- --------------|---------|-------------------------------------------------------------------------|---------------
230
- `recursive` | Boolean | Recursively search for nested files if dir path passed. | `true`
231
- `verbose` | Boolean | Show logging in console/terminal. | `true`
232
- `dotFolders` | Boolean | Include dotfolders in file search. | `false`
233
- `minify` | Boolean | Minify output CSS. | `true`
234
- `sourceMaps` | Boolean | Generate CSS source maps. | `true`
235
- `ignoreFiles` | Array | Files (by name) to exclude from compilation. | `[]`
236
- `comment` | String | Header comment to prepend to compiled CSS. Separate by line using '\n'. | `''`
229
+ Name | Type | Desciption | Default value
230
+ ---------------|---------|-------------------------------------------------------------------------|---------------
231
+ `recursive` | Boolean | Recursively search for nested files if dir path passed. | `true`
232
+ `verbose` | Boolean | Show logging in console/terminal. | `true`
233
+ `dotFolders` | Boolean | Include dotfolders in file search. | `false`
234
+ `minify` | Boolean | Minify output CSS. | `true`
235
+ `sourceMaps` | Boolean | Generate CSS source maps. | `true`
236
+ `cloneFolders` | Boolean | Preserve folder structure in output dir | `false`
237
+ `ignoreFiles` | Array | Files (by name) to exclude from compilation. | `[]`
238
+ `comment` | String | Header comment to prepend to compiled CSS. Separate by line using '\n'. | `''`
237
239
 
238
240
  #
239
241
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamlui/scss-to-css",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Recursively compile all SCSS files into minified CSS",
5
5
  "author": {
6
6
  "name": "Adam Lui",
@@ -65,9 +65,9 @@
65
65
  },
66
66
  "dependencies": {
67
67
  "node-clipboardy": "^1.0.3",
68
- "sass": "^1.97.0"
68
+ "sass": "^1.97.2"
69
69
  },
70
70
  "devDependencies": {
71
- "@adamlui/minify.js": "^1.8.6"
71
+ "@adamlui/minify.js": "^1.9.0"
72
72
  }
73
73
  }