我想编写一个 Grunt 任务,在构建期间,它将复制我拥有的所有 .html 文件并在 /dist 中制作它的 .asp 版本。
我一直在尝试使用grunt-contrib-copy来完成此任务,这就是我所拥有的:
copy: {
//some other tasks that work...
//copy an .asp version of all .html files
asp: {
files: [{
expand: true,
dot: true,
cwd: '<%= config.app %>',
src: ['{,*/}*.html'],
dest: '<%= config.dist %>',
option: {
process: function (content, srcpath) {
return srcpath.replace(".asp");
}
}
}]
} //end asp task
},
我知道该process
函数实际上并不正确......我尝试了一些不同的正则表达式以使其无济于事。当我运行asp
任务时,Grunt CLI 说我已经复制了 2 个文件,但是找不到它们。任何帮助表示赞赏。