我似乎无法找到一种简单的方法将所有文件从Polymer复制到使用grunt-bower-task. grunt.initConfig({ bower: { install: { options: { targetDir: 'wwwroot/lib', layout: 'byComponent', install: true, copy: true, verbose: true,
grunt.initConfig({
bower: {
install: {
options: {
targetDir: 'wwwroot/lib',
layout: 'byComponent',
install: true,
copy: true,
verbose: true,
cleanTargetDir: false,
bowerOptions: {}
}
}
}
据我所知,只有每个元素的bower.json文件中定义的主文件才会被复制.我也知道我可以在我自己的bower.json中放一个exportsOverride部分来包含更多这样的文件 –
"exportsOverride": {
"*": {
"": "*.*",
"demo": "demo/*.*",
"test": "test/*.*"
}
}
但这并未涵盖所有情况,因为某些元素包含的子文件夹多于演示和测试.我是否必须手动查看它们并将它们的路径添加到exportsOverride,或者有一种我忽略的简单方法?
讨厌提供失败的样本….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'},
],
},
},
