Grunt task to compile SASS and SCSS using the superfast libsass via node-sass.
Note that node-sass is currently under heavy development and might be unstable, there are also some stuff missing, like compression options and file/folder context.
Install this grunt plugin next to your project's grunt.js gruntfile with: npm install grunt-sass
Then add this line to your project's grunt.js
gruntfile:
grunt.loadNpmTasks('grunt-sass');
This grunt task is a multi task, which means you can specify multiple subtasks and grunt will iterate over them. The dist
below is a subtask, you could e.g. create a dev
subtask to handle stuff while developing.
sass: {
dist: {
src: 'main.scss',
dest: 'main.css'
}
}
If you specify an array of files they will be concatenated. However, in most cases you would want to just @import
them into main.scss
.
sass: {
dist: {
src: [
'reset.scss',
'main.scss'
],
dest: 'combined.css'
}
}
Grunt currently doesn't have a way to test tasks directly. You can test this task by running grunt
and manually verify that it works.
In lieu of a formal styleguide, take care to maintain the existing coding style.
MIT License (c) Sindre Sorhus