Gruntjs 在grunt中,如何从clean In dist文件夹中排除.git文件夹
目前我的代码是:Gruntjs 在grunt中,如何从clean In dist文件夹中排除.git文件夹,gruntjs,yeoman,Gruntjs,Yeoman,目前我的代码是: clean: { dist: { files: [{ dot: true, src: [ '.tmp', '<%= yeoman.dist %>/{,*/}*', '!<%= yeoman.dist %>/.git/**' ] }] }, server: '
clean: {
dist: {
files: [{
dot: true,
src: [
'.tmp',
'<%= yeoman.dist %>/{,*/}*',
'!<%= yeoman.dist %>/.git/**'
]
}]
},
server: '.tmp'
},
clean:{
地区:{
档案:[{
多特:没错,
src:[
“.tmp”,
'/{,*/}*',
“!/.git/**”
]
}]
},
服务器:'.tmp'
},
但它仍在删除dist文件夹中的.git文件夹 忽略src数组中的.git可以避免删除它。以下任务适合我(在第节之前): 上面的清理任务清除dist和temp文件夹的全部内容,dist/.git文件夹和dist/.gitignore文件中的内容除外 我将此任务作为构建和部署流程的一部分使用,它工作正常,在每次构建和部署之后我都会保持提交,尽管dist文件夹已清理(没有.git) 希望这对别人有帮助
clean: {
before: {
src: ['dist/**/*', '!dist/.git/**', '!dist/.gitignore', 'temp'] //do not clean the git folder
},
after: {
src: ['temp']
}
},