質問

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