Angularjs Nganotate不会像应该的那样对文件进行注释和覆盖
我试图在我的构建中使用grunt ng annotate,而我的文件在查看时似乎没有被注释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' }] } }, 不过,
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',
}],
}
},