grunt watch 任务不是看 js 文件只是说等待

grunt watch task is not watching js files just says waiting

几天来我一直在尝试配置这个 g运行tfile,我已经看过并阅读了多个关于如何设置它的文档。我已经能够设置它,所以我可以通过在 bash:

中输入单独的命令来 运行 单独的任务

g运行t 变丑 g运行tsass g运行t cssmin

但是 g运行t watch 似乎不看我的任何 js 文件

所有这些都工作正常,但是当我尝试在 "watch" 任务下 运行 它们时,我的 js 文件都被忽略了。我的命令行只显示 'waiting...'。更改我的 js 文件中的任何内容都不会触发更新。我也有 toruble 运行ning jshint,因为它一直告诉我它正在寻找字符串等,所以我暂时禁用了该插件。这是我的文件:

module.exports = function (grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    sass: { // Task 
      dist: { // Target        
        files: { // Dictionary of files 
          'assets/css/style.css': 'assets/scss/style.scss'
          // 'destination': 'source' 

        }
      }
    },

    cssmin: {
      options: {
        banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") 
      %> \n*/\n'
      },
      build: {
        files: {
          'assets/css/style.min.css': 'assets/css/style.css'
        }
      }
    },
    uglify: {
      options: {
        banner: '/*\n <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") 
      %> \n*/\n'
      },
      build: {
        files: {
          'assets/js/magic.min.js': ['assets/js/magic.js', 
           'assets/js/server.js', 'assets/js/script.js']
        }
      }
    },
    // configure jshint to validate js files -------------------------------
    // jshint: {
    //   options: {
    //     reporter: require('jshint-stylish')  

    //   },

    //   // when this task is run, lint the Gruntfile and all js files in 
    src
    //   build: ['Gruntfile.js', 'assets/**/*.js']
    // },


    watch: {

      // for stylesheets, watch css and less files 
      // only run less and cssmin stylesheets: { 
      files: ['assets/**/*.css', 'assets/**/*.less'],
      tasks: ['sass', 'cssmin']
    },

    // for scripts, run jshint and uglify 
    scripts: {
      files: 'assets/**/*.js',
      tasks: 'uglify'
    }
  });
  // Default tasks
  //grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-concurrent');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.registerTask('default', ['uglify', 'cssmin', 'sass', 'watch']);
};

我想你想这样做?

watch: {
    stylesheets: { 
      files: ['assets/**/*.css', 'assets/**/*.less'],
      tasks: ['sass', 'cssmin']
    },

    // for scripts, run jshint and uglify 
    scripts: {
      files: 'assets/**/*.js',
      tasks: 'uglify'
    }
  }