Question

module.exports = function(grunt) {
  concat: {
        main:{
            src: ['public/dev/css/normalize.css', 'public/dev/css/form.css'],
            dest: 'public/dev/css/styles.css'
        }
    },
  watch: {
      concat_css: {
        files: ['public/dev/css/normalize.css', 'public/dev/css/form.css'],
        task: ['concat']
      }
});

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');

When I change any of the files Grunt watches changes and wtites to terminal:

File "public\dev\css\form.css" changed.

But doesnt do concatenation of the files.

but it do work if we start grunt concat...

Était-ce utile?

La solution

The config property of the watch should be tasks instead of task (plural).

Change your config to the following:

watch: {
  concat_css: {
    files: ['public/dev/css/normalize.css', 'public/dev/css/form.css'],
    tasks: ['concat']
  }
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top