How to install bower components to multiple paths with bower-installer?

209 views Asked by At

I have my bower.json like:

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

to install font related resources to static/my-project/libs/bower-package-name/fonts/.

But I found that slick.js expects fonts to be placed in bower-package-name/css/fonts, not bower-package-name/fonts/.

Since I have other dependency that expects fonts to be located in bower-package-name/fonts/, I want to install these font related resources to multiple paths, both in bower-package-name/fonts/ and bower-package-name/css/fonts.

Is there any way to install bower dependencies to multiple paths like:

..
"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"],
    ..
    }
},
..

for example?

1

There are 1 answers

0
Akshay Gundewar On

If you are using grunt, you can use grunt-contrib-copy to copy your resources to different location.

Sample grunt copy task would look like (from the above source):

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