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...

有帮助吗?

解决方案

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']
  }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top