我已经将Grunt配置为使用ng-annotate。我想要的是注释特定目录中的所有.js文件,并在注释完成时将它们复制到新目录中。但是,完整的src文件夹将复制到新目录中。这是我的配置:
ngAnnotate: {
options: {
singleQuotes: true
},
dist: {
files: [{
expand: true,
src: ['./src/modules/*.js'],
dest: './src/min-safe',
ext: '.annotated.js',
extDot: 'last'
}],
}
}这样,我就有了一个包含src/modules和带注释的文件的min-safe文件夹。如何才能直接将带注释的文件复制到min-safe中?
发布于 2016-08-12 08:15:36
Grunt的src和dest选项可能会令人困惑,但它们在所有插件中都是一致的(至少,它们应该是一致的)。Grunt文档解释了how those options can be used如何处理文件。
您的问题是您没有指定cwd选项,所以所有的src匹配都是针对项目的当前目录(缺省的cwd )。复制src文件时,将包括cwd和匹配文件之间的目录。
如果您使用此配置,它应该可以执行您想要的操作:
ngAnnotate: {
options: {
singleQuotes: true
},
dist: {
files: [{
expand: true,
cwd: './src/modules',
src: ['*.js'],
dest: './src/min-safe',
ext: '.annotated.js',
extDot: 'last'
}]
}
}https://stackoverflow.com/questions/38871307
复制相似问题