Tool for installing bower dependencies that won't include entire repos. Although Bower works great as a light-weight tool to quickly install browser dependencies, it currently does not provide much functionality for installing specific "built" components for the client.
bower install is run on this configuration file, the entire backbone repository will be pulled down
and copied into a components directory. This repository is quite large, when probably only a built js and css
file are needed. Bower conveniently provides the
bower list --paths command to list the actual main files associated
with the components (if the component doesn't define a main, then the whole repository is listed instead).
Bower installer provides an easy way for the main files to be installed or moved to one or more locations. Simply add to
your bower.json an
install key and
Install bower-installer by executing
npm install -g bower-installer
From the terminal in the same directory as your bower.json file, enter:
After executing this,
backbone.js will exist under
some/path relative to the location of your
A lot of registered components for bower do not include bower.json configuration. Therefore, bower does not know about any "main files" and therefore, by default bower-installer doesn't know about them either. Bower-installer can override an existing main file path or provide a non-existant one:
If bower installer is run on this configuration,
backbone.js will all appear under
some/path relative to your bower.json file.
For one reason or another you may want to install multiple files from a single component. You can do this by providing
Array instead of a
String inside the sources hash. Or you can use file matchers https://github.com/isaacs/minimatch:
Files can be installed to multiple locations based upon file type or regular expression. Do so by modifying the
path to be a map of file-type
Paths can be custom configurable with variables (key, name and version):
Will create this output structure:
Files can be renamed when bower-installer is copying them to their new destination. Do so by modifying the
mapping object. Example:
Files can be ignored and not copied. Do so by adding the appropriate to the
ignore array. In the following example,
ember-model has as dependency on
handlebars, so normally
ember and the
handlebars js files would be copied but in this case we don't want them copied over.
You can specify a folder and get all files inside it preserving its folder structure. Example:
Entire folders can be mapped. Example:
will result in
build/src/jquery-ui/base/* contains the CSS and JS for the base theme.
The package name can be excluded from the
will result in
build/src/base/* contains the CSS and JS for the base theme.