我似乎无法找到一种简单的方法将所有文件从聚合物复制到使用 grunt-bower-task 。
grunt.initConfig({
bower: {
install: {
options: {
targetDir: 'wwwroot/lib',
layout: 'byComponent',
install: true,
copy: true,
verbose: true,
cleanTargetDir: false,
bowerOptions: {}
}
}
}
我了解只有每个元素的 bower.json 文件中定义的main
文件才会被复制。我也知道我可以在我自己的 bower.json 中添加exportsOverride
部分以包含更多这样的文件 -
"exportsOverride": {
"*": {
"": "*.*",
"demo": "demo/*.*",
"test": "test/*.*"
}
}
但这并未涵盖所有情况,因为某些元素的子文件夹多于 demo 和 test 。我是否必须手动查看它们并将其路径添加到exportsOverride
,或者有一种我忽略的简单方法?
答案 0 :(得分:1)
讨厌提供失败的样本......
FWIW最近,我有类似的问题...工作和失败
我所做的就是放弃在" dist"第一个聚合物项目的标签。相反,我只是在一个或两个元素上运行minify / ugly,留下HTTP2类型的文件结构(深层和许多,dirs /文件。)
// the process belo NG . Manual edit needed on "polymer-min.html" go end and chg the js file name
copy: {
main: {
files: [
// includes files within path
{expand: true, src: ['*html'], dest: 'dest/', filter: 'isFile'},
// includes files within path and its sub-directories
{expand: true, src: ['js/**', 'images/**' ,'css/**' ,'elements/**' ,'bower_components/**'], dest: 'dest/'},
{ src: ['tmp/csp/build-csp.html'], dest: 'dest/bower_components/cast-button-polymer/cast-button-polymer-min.html',
filter: 'isFile',
options: {
process: function (content, srcpath) {
return content.replace(/build-csp.js/g,"cast-button-polymer-min.js");
},
},
},
{ src: ['tmp/csp/build-csp-min.js'], dest: 'dest/bower_components/cast-button-polymer/cast-button-polymer-min.js', filter: 'isFile'},
],
},
},