I have a project that uses GruntJS with grunt-contrib-sass, grunt-contrib-watch and grunt-newer.
My main app.scss file imports a few .scss files with the @import directive like
@import "common/vars.scss";
If I make changes in the main app.scss everything works. The problem is that when I make changes in a file that is being imported (like vars.scss), the app.scss doesn't get updated.
This is my watch task:
watch: {
css: {
files: ['scss/**/*.scss'],
tasks: ['newer:sass'],
options: {
spawn: false,
}
}
}
And this is the sass task itself:
sass: {
dist: {
options: {
style: 'compressed',
noCache: true
},
/* looks for every .scss file in the scss folder (checks nested folders too),
* compile it and create another file wit the same name in the style folder */
files: [{
expand: true,
cwd: 'scss',
src: ['**/*.scss'],
dest: 'style',
rename: function (dest, src) {
var folder = src.substring(0, src.lastIndexOf('/'));
var filename = src.substring(src.lastIndexOf('/'), src.length);
filename = filename.substring(0, filename.lastIndexOf('.'));
return dest + '/' + folder + filename + '.css';
}
}]
}
}
Any idea how to change the Gruntfile.js to cover this scenario too? :) Thanks.