Gruntjs 在运行dist命令时,如何修改grunt以排除所有bower_组件自述文件和示例文件?
我想运行一个grunt dist例程,排除使用bower安装软件包时获得的所有额外文件 当我使用bower下载一个包时,我会得到一堆自述文件和示例文件夹 我该怎么做Gruntjs 在运行dist命令时,如何修改grunt以排除所有bower_组件自述文件和示例文件?,gruntjs,bower,Gruntjs,Bower,我想运行一个grunt dist例程,排除使用bower安装软件包时获得的所有额外文件 当我使用bower下载一个包时,我会得到一堆自述文件和示例文件夹 我该怎么做 我试图修改我的grunt文件,但没有效果。想法是在文件grunfile.js下的copy任务中只包含您需要的文件 删除行components/***,自己添加include文件,新的grunfile.js应该如下所示: copy: { dist: { files: [{ expand: true,
我试图修改我的grunt文件,但没有效果。想法是在文件
grunfile.js
下的copy
任务中只包含您需要的文件
删除行components/***
,自己添加include文件,新的grunfile.js
应该如下所示:
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,txt}',
'.htaccess',
'images/{,*/}*.{gif,webp}',
'styles/fonts/*',
'components/jquery/jquery.min.js',
'components/lodash/lodash.js'
]
}]
}
},
复制:{
地区:{
档案:[{
是的,
多特:没错,
cwd:“”,
目标:'',
src:[
“*.{ico,txt}”,
“.htaccess”,
'images/{,*/}*{gif,webp}',
“样式/字体/*”,
'components/jquery/jquery.min.js',
'components/lodash/lodash.js'
]
}]
}
},
这个想法是在文件grunfile.js
下的copy
任务中只包含您需要的文件
删除行components/***
,自己添加include文件,新的grunfile.js
应该如下所示:
copy: {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,txt}',
'.htaccess',
'images/{,*/}*.{gif,webp}',
'styles/fonts/*',
'components/jquery/jquery.min.js',
'components/lodash/lodash.js'
]
}]
}
},
复制:{
地区:{
档案:[{
是的,
多特:没错,
cwd:“”,
目标:'',
src:[
“*.{ico,txt}”,
“.htaccess”,
'images/{,*/}*{gif,webp}',
“样式/字体/*”,
'components/jquery/jquery.min.js',
'components/lodash/lodash.js'
]
}]
}
},
我试图使用require js FileExclutionRegExp来实现这一点,但我可以将复制文件移到上面的代码中。谢谢使用grunt contrib副本。我希望这能奏效。grunt contrib copy是一个很好的补充。使用FileExclutionRegExp:/^.| |((json)|(md)|(map)|(txt)|(sh))| scss | docs | examples | test | dist | Makefile | Rakefile | LICENSE | CNAME$/,//如果regexp匹配,这意味着文件/目录将被排除。:和grunt contrib clean删除我们无法使用FileExclutionRegExp捕获的文件/目录。我试图使用require js FileExclutionRegExp执行此操作,但我可以将复制文件移到上述代码。谢谢使用grunt contrib副本。我希望这能奏效。grunt contrib copy是一个很好的补充。使用FileExclutionRegExp:/^\.|((json)|(md)|(map)|(txt)|(sh))| scss | docs | examples | test | dist | Makefile | Rakefile | LICENSE | CNAME$/,//如果regexp匹配,则意味着文件/目录将被排除。:grunt contrib clean删除我们无法用FileExclutionRegExp捕获的文件/目录