I'd like to use grunt-contrib-watch to watch my .scss files, compile them and then concatenate them. Right now since I am watching .scss and .css files the changes to my .scss files kick off the task and then the .css changes restart the task and it gets stuck in a loop. How can I order the tasks such that 'concat' will run after 'sass'?
module.exports = function(grunt) {
grunt.initConfig ({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
css: {
src: ['src/css/reset.css', 'src/css/syntax.css', 'src/css/main.css'],
dest: 'dest/css/built.css'
}
},
sass : {
dist: {
files: {
'src/css/main.css' : 'src/css/main.scss'
}
}
},
watch : {
files: ['src/css/*.scss', 'src/css/*.css'],
tasks: ['sass', 'concat'],
options: {}
}
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['sass', 'concat']);
};