I am trying to compile multiple .scss files into a single CSS file. This actually works but only grabs the first file...
sass: { // Task
dist: {
files: {
'css/test.css':'sass/*.scss'
}
}
}
We don't have ruby installed so grunt-contrib-sass is not an option. I do the same thing in Stylus like this...
stylus: {
compile : {
files : {
'css/g.css' : 'stylus/*.styl'
}
}
}
You can use "grunt-sass-globbing". It will generate a SCSS file with all the imports you specified in your Gruntfile. https://www.npmjs.com/package/grunt-sass-globbing/
With this option you can keep your source maps and you don't need to concatenate your SCSS files.
Step 1: Create import file
Step 2: Compile your import file
it's very simple.
let's say you have this structure with 2 scss files:
so what you need to do is: create a file called: main.scss in your root scss folder and import all your scss files:
e.g.: main.scss will have:
now use grunt-contrib-sass and just call the main.scss file:
done :)
I just want to touch on this, because I had the same issue, and this will actually work:
Let me know how it goes!
What about running
grunt-contrib-concat
first?and then task:
edit
How are you using
@import
? I'm not an expert on the specifics, but here is what I do...dir/
main.scss
If you don't wanna use concat, you can specify all files in directory. Checkout this example: https://github.com/gruntjs/grunt-contrib-sass#compile-files-in-a-directory