Grunt文件只监视HTML中的更改

时间:2014-08-21 23:17:48

标签: gruntjs grunt-contrib-watch

我正在尝试设置一个grunt文件来监视多个文件中的更改,例如sass,javascript和HTML。目前它只监视对HTML文件所做的更改。我根据我发现的教程设置了它,它似乎对他们来说效果很好,但它对我不起作用。有谁知道我做错了什么?这是我第一次与grunt合作。

module.exports = function(grunt) {
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.initConfig({
      uglify: {
        my_target: {
          files: {
            '_/js/script.js' : ['_js/components/js*.js'],
          }//files
        }//my_target
      },//uglify
      compass: {
        dev: {
          options: {
            config: 'config.rb'
          }//options
        }//dev
      },//compass
      watch: {
        options: { livereload: true },
        scripts: {
            files: ['_components/js/*.js'],
            task: ['uglify']
        }, //script
        sass: {
            files: ['_components/sass/*.scss'],
            task: ['compass:dev']
        }, //sass
        html: {
            files: ['*.html']
        }, //html
    }, //watch
  });//initConfig
  grunt.registerTask('default', ['watch', 'compass:dev']);
};//exports

0 个答案:

没有答案