Compile multiple scss files
Is there a way to compile multiple scss files?
Yes, can you elaborate on what you're trying to do?
@hellobrian Supposedly I have this structure.
├── css │ └── style.css ├── scss │ └── style.scss │ └── forms.scss
I want to keep my sass files split into different files but have only one after the compilation.
This is what my current setup look like:
"scripts": {
"sass": "node-sass --include-path scss scss/style.scss css/style.css --output-style compressed",
"watch:sass": "npm run sass -- --watch"
},
With node-sass, you can keep your scss files compiling to separate files by writing new scripts. So to allow forms.scss to compile to forms.css:
"scripts": {
"form-sass": "node-sass --include-path scss scss/form.scss css/form.css --output-style compressed"
}
Or if you're okay with always having your scss files compile to seperate css files, then you can rely on using this script:
"scripts": {
"sass": "node-sass scss --include-path scss --output css --output-style compressed",
}
- instead of giving node-sass specific files, you can give it directories for input and output but make sure to add the
--outputflag when working with directories.
See the docs here: https://github.com/sass/node-sass#usage-1
OK,
"sass": "node-sass scss --include-path scss --output css --output-style compressed", seems like what I need but, is there a way to merge all the files from the scss directory in one css file?
Your original script will merge all scss files into one css file but you have to make sure you're writing @import statements in your main scss file.
This is what I was looking for: @import
Thanks