grunt-bower-task和Polymer [英] grunt-bower-task and Polymer

查看:71
本文介绍了grunt-bower-task和Polymer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法找到将聚合中的所有文件复制到 grunt-bower-task 的简便方法。

  grunt.initConfig({
bower:{
install:{
options:{
targetDir:'wwwroot / lib',
layout:'byComponent',
install:true,
copy:true,
详细信息:true,
cleanTargetDir:false ,
bowerOptions:{}
}
}
}

据我所知,只有在每个元素的 bower.json 文件中定义的主要文件才会被复制,我也知道我可以把在我自己的 bower.json 中包含 exportsOverride 部分以包含更多此类文件 -

 exportsOverride:{
*:{
:*。*,
demo:demo /*.*,
test:test /*.*
}
}

但这并不包括所有情况,因为一些元素的子文件夹多于 demo test 。我是否必须手动查看它们并将它们的路径添加到 exportsOverride 中,或者有一种我忽略的简单方法?
<讨厌提供一个失败的样本....



FWIW最近,我曾经非常相似问题...工作,并失败

我所做的就是放弃尝试将第一个聚合物项目的dist标签中的所有内容压平。相反,我只是在一个或两个元素上运行minify / ugly,留下了HTTP2类型的文件结构(深层和很多很多,dirs / files)。

pre $ code> //过程belo NG。手动编辑需要在聚合物min.html去结束和chg的js文件名
副本:{
main:{
文件:[
//包括路径内的文件
{expand:true,src:['* html'],dest:'dest /',filter:'isFile'},
//包含路径及其子目录中的文件
{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 - 聚合物-min.js);
},
},
},
{src:['tmp / csp / build-csp-min.js'],dest:'dest / bower_components / cast- button-polymer / cast-button-polymer-min.js',过滤器:'isFile'},
],
},
},


I cannot seem to find an easy way to copy all the files from Polymer to using grunt-bower-task.

grunt.initConfig({
    bower: {
        install: {
            options: {
                targetDir: 'wwwroot/lib',
                layout: 'byComponent',
                install: true,
                copy: true,
                verbose: true,
                cleanTargetDir: false,
                bowerOptions: {}
            }
        }
    }

I understand that only the main files defined inside each element's bower.json file get copied over. I am also aware that I could put a exportsOverride section in my own bower.json to include more files like this -

  "exportsOverride": {
    "*": {
      "": "*.*",
      "demo": "demo/*.*",
      "test": "test/*.*"
    }
  }

But this doesn't cover all cases as some elements have more sub-folders than just demo and test. Do I have to manually look them all up and add their paths to the exportsOverride, or there's an easy way that I've overlooked?

解决方案

hate to provide a sample of a fail....

FWIW recently , i had very similar issue ... worked it and failed

what i did is abandon the attempt to flatten everything out in the "dist" tag for a first polymer project. Rather i just ran minify/ugly on one or two elements leaving the HTTP2 type file structure ( deep and many many, dirs/files. )

// 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'},         
        ],
      },
},

这篇关于grunt-bower-task和Polymer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆