ngAnnotate不会像它应该那样注释和覆盖文件

时间:2015-02-11 18:25:23

标签: angularjs gruntjs

我试图在我的构建中使用grunt-ng-annotate,当我查看它们时,我的文件似乎没有被注释。

ngAnnotate: {
  options: {
    singleQuotes: true
  },
  dist: {
    files: [{
      expand: true,
      cwd: '.tmp/concat/scripts',
      src: '*.js',
      dest: '.tmp/concat/scripts'
    }]
  }
},

但是,如果我添加:

      ext: '.annotated.js',

然后我可以在文件中看到注释。它似乎不知何故,它只是不想覆盖旧文件,除非我将它们命名为不同的东西。这是什么交易?

1 个答案:

答案 0 :(得分:0)

我今天也遇到了这个问题。我决定为自己发布解决方案,因为我真的很挣扎,并且想到也许其他人可能在某些时候需要这个。所以我要做的就是为ngAnnotate设置删除和添加选项,这样它就可以删除和添加这样的带注释的项目:

   ngAnnotate: {
       options: {
           remove: true,
           add: true
       },
       dist: {
           files: [{
                   expand: true,
                   sourceMap: true,
                   src: 'src/js/**/*.js',
               }],
       }
   },
相关问题