Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs Nganotate不会像应该的那样对文件进行注释和覆盖_Angularjs_Gruntjs - Fatal编程技术网

Angularjs Nganotate不会像应该的那样对文件进行注释和覆盖

Angularjs Nganotate不会像应该的那样对文件进行注释和覆盖,angularjs,gruntjs,Angularjs,Gruntjs,我试图在我的构建中使用grunt ng annotate,而我的文件在查看时似乎没有被注释 ngAnnotate: { options: { singleQuotes: true }, dist: { files: [{ expand: true, cwd: '.tmp/concat/scripts', src: '*.js', dest: '.tmp/concat/scripts' }] } }, 不过,

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

ngAnnotate: {
  options: {
    singleQuotes: true
  },
  dist: {
    files: [{
      expand: true,
      cwd: '.tmp/concat/scripts',
      src: '*.js',
      dest: '.tmp/concat/scripts'
    }]
  }
},
不过,如果我补充:

      ext: '.annotated.js',

然后我可以在文件中看到注释。看起来它只是不想覆盖旧文件,除非我给它们起了不同的名字。这是怎么回事?

我今天也遇到了这个问题。我决定为自己发布解决方案,因为我真的很难解决这个问题,我想也许有人会在某个时候需要这个。所以我要做的是为ngAnnotate设置remove和add选项,这样它就可以删除和添加注释项,如下所示:

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