I have this workflow:
module.exports = function(grunt) { require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks grunt.initConfig({ sass: { options: { sourceMap: true }, dist: { } }, watch: { files: ['src/*.scss'], tasks: ['sass'] } }); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ["sass"]); };
After running grunt watch and changing the src/*.scss I get the following:
The file "src / main.scss" has been modified. Performing the sass: dist task (sass)
Done, no errors. Completed in 0.949s on Tue 02/02 2016 11:25:11 GMT + 0100 (CET) - Waiting ...
My problem: where is the generated file? How to specify the destination file?
I also tried using this workflow:
module.exports = function(grunt) { require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks grunt.initConfig({ sass: { options: { sourceMap: true }, dist: { files: [{ expand: true, cwd: 'src', src: ['*.scss'], dest: '.', ext: '.css' }] } }, watch: { files: ['*.scss'], tasks: ['sass'] } }); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ["sass"]); };
and grunt watch also works, but when I change src/*.scss nothing happens.
EDIT : this is my grunt file after the answers:
module.exports = function(grunt) { require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks grunt.initConfig({ sass: { options: { sourceMap: true }, dist: { files: [{ expand: true, cwd: '.', src: ['src/**/*.scss'], dest: '.', ext: '.css' }] } }, watch: { files: ['src/**/*.scss'], tasks: ['sass'] } }); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.registerTask('default', ["sass"]); };