我grunt copy
定义了一对任务:
copy : {
develop : {
expand : true,
flatten : false,
cwd : "develop/",
src : ["index.html", "gwt/**/*", "!**/*.less", "!**/*.scss", "modules/**/*", "components/**/*", "resources/**/*", "!resources/styles/**"],
dest : "build/"
},
// TODO: figure out how to update glyphicon paths to build
bootstrap_assets : {
expand : true,
flatten : false,
src : ["bower_components/bootstrap-sass/assets/fonts/**/*"],
dest : "build/"
},
}
并将它们组合在自定义任务中
// Intermediate Task - Copy dev resources to build
grunt.registerTask("copy_dev", ["copy:develop", "copy:bootstrap_assets"]);
在modules
文件夹内,我想复制所有内容但scss
文件。当我运行时grunt copy:develop
,这具有我期望的行为,除了*.scss
复制之外的所有文件。但是,当我运行时grunt copy_dev
,所有内容modules
都会被复制过来。
这是输出的一部分grunt copy_dev --verbose
:
Running "copy:develop" (copy) task
Verifying property copy.develop exists in config...OK
Files: develop/modules/front-page -> build/modules/front-page
Files: develop/modules/front-page/front-page.html -> build/modules/front-page/front-page.html
Files: develop/modules/front-page/front-page.scss -> build/modules/front- page/front-page.scss
Files: develop/modules/login -> build/modules/login
Files: develop/modules/login -> build/modules/login
Files: develop/modules/login/bigLogo.png -> build/modules/login/bigLogo.png
Files: develop/modules/login/login-view.html -> build/modules/login/login-view.html
Files: develop/modules/login/login.js -> build/modules/login/login.js
Files: develop/modules/login/login.scss -> build/modules/login/login.scss
Files: develop/modules/login/logo -> build/modules/login/logo
Files: develop/modules/login/logo/lg.png -> build/modules/login/logo/lg.png
Files: develop/modules/login/logo/md.png -> build/modules/login/logo/md.png
Files: develop/modules/login/logo/sm.png -> build/modules/login/logo/sm.png
如您所见,*.scss
执行自定义任务时会复制许多文件,而它们不会通过常规copy:$name
调用进行。
为什么是这样?