Aaron
Aaron

Reputation: 14029

Solutions for installing libraries without a prebuilt file in bower

Some libraries don't have an already build JavaScript file in their Github repository because the authors of these libraries are against keeping build artifacts around (Sinon.JS for example). Is there a preferred way to deal with this using Bower?

I know that I could fork the repository and register my fork with the prebuilt file with Bower. I'm just not sure if this is the best/correct way to handle this.

Upvotes: 8

Views: 2684

Answers (2)

Benja
Benja

Reputation: 4154

If there's not a proper Bower package registeres, you can install from any git repo (you can specify versions if there are proper git tags), and even from a .zip or .tar.gz files if you provide an url. This is from http://bower.io/

bower install <package>

Where <package> can be any one of the following:

  • A name that maps to a package registered with Bower, e.g, jquery.
  • A remote Git endpoint, e.g., git://github.com/someone/some-package.git. Can be public or private.
  • A local Git endpoint, i.e., a folder that's a Git repository.
  • A shorthand endpoint, e.g., someone/some-package (defaults to GitHub).
  • A URL to a file, including zip and tar.gz files. It's contents will be extracted.

Of course you won't get any dependency resolution this way, but you can take care of that manually adding any dependency explicitly to your bower.json file

Upvotes: 13

Sindre Sorhus
Sindre Sorhus

Reputation: 63487

Currently that is the best way. You can also keep it locally and reference it in 'dependencies' with full path. We're working on adding ability for author to publish components, like npm.

Upvotes: 4

Related Questions