如何使用bower-installer将bower组件安装到多个路径?

时间:2015-06-23 15:35:34

标签: bower bower-install

我的 bower.json 就像:

..
"install": {
    "base": "static/my-project/libs",
    "path": {
     ..
    "eot": "{name}/fonts",
    "otf": "{name}/fonts",
    "svg": "{name}/fonts",
    "woff": "{name/fonts",
    ..
    }
},
..

将字体相关资源安装到static/my-project/libs/bower-package-name/fonts/

但我发现slick.js要求字体放在bower-package-name/css/fonts中,而不是bower-package-name/fonts/

由于我有其他依赖项,希望字体位于bower-package-name/fonts/,我想在bower-package-name/fonts/bower-package-name/css/fonts中将这些字体相关资源安装到多个路径。

有没有办法将bower依赖项安装到多个路径,如:

..
"install": {
    "base": "static/my-project/libs",
    "path": {
     ..
    "eot": ["{name}/fonts", "{name}/css/fonts"],
    "otf": ["{name}/fonts", "{name}/css/fonts"],
    "svg": ["{name}/fonts", "{name}/css/fonts"],
    "woff": ["{name}/fonts", "{name}/css/fonts"],
    ..
    }
},
..

例如?

1 个答案:

答案 0 :(得分:0)

如果您使用的是咕噜声,则可以使用grunt-contrib-copy将资源复制到其他位置。

示例grunt复制任务看起来像(来自上面的来源):

 copy: {
  main: {
    files: [
      // includes files within path
      {expand: true, src: ['path/*'], dest: 'dest/', filter: 'isFile'},

      // includes files within path and its sub-directories
      {expand: true, src: ['path/**'], dest: 'dest/'},

      // makes all src relative to cwd
      {expand: true, cwd: 'path/', src: ['**'], dest: 'dest/'},

      // flattens results to a single level
      {expand: true, flatten: true, src: ['path/**'], dest: 'dest/', filter: 'isFile'},
    ],
  },
 },