uglify任务使用grunt

时间:2016-06-06 10:38:09

标签: javascript gruntjs

我在init函数中有这个:

uglify: {
      dist: {
        files: {
          '<%= yeoman.dist %>/scripts/scripts.js': [
            '<%= yeoman.dist %>/scripts/scripts.js'
          ]
        }
      }
    },

除了脚本文件没有被修改外,一切运行正常。我收到这样的错误:

Running "uglify:dist" (uglify) task
>> Destination dist/scripts/scripts.js not written because src files were empty.

我在package.json "grunt-contrib-uglify": "^0.7.0",

里面有咕噜声
>> No files created.

1 个答案:

答案 0 :(得分:0)

如错误所示:src文件为空。

请参阅此doc

grunt.initConfig({
  uglify: {
      my_target: {
          files: {
              'dest/output.min.js': ['src/input1.js', 'src/input2.js']
          }
      }
  }
});

在您的代码中,您已将目标文件指定为源文件。