Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install libraries such as OpenLayers with Bower?

I'm giving a try at Bower from the guys at Twitter, to manage my client-side dependencies.

But I'm facing a nasty problem: apart from a few big players (jQuery, and of course, Bootstrap by Twitter), many libraries (most of them, actually) don't have a component.json file, and thus don't seem to support Bower.

This is the case with OpenLayers, which is a big player, hence my surprise to find them not supporting Bower.

Am I missing something here? Or are there more common dependency managers that these big libraries do support at the moment?

like image 908
BenMorel Avatar asked Dec 03 '22 00:12

BenMorel


2 Answers

You can just to add the following as a dependency:

"dependencies": {
    "OpenLayers" : "http://openlayers.org/download/OpenLayers-2.12.zip"
}

and run bower install again.

Update After Sindre remarks this conf breaks the bower upgrade you should rely on something like this : bower install openlayers --save

But be aware that if the artifacts you rely on it are not versionned in the repo, you'll have to build them in your dev workflow. It means having some more tools installed, and understanding them, etc.

like image 146
xavier.seignard Avatar answered Jan 09 '23 20:01

xavier.seignard


A component file is only required if the library has dependencies, otherwise the git tag is used.

You can do bower install openlayers since it's in the registry, otherwise you can use an url to a git repo or zip/tar file: bower install git://github.com/openlayers/openlayers.git.

like image 34
Sindre Sorhus Avatar answered Jan 09 '23 21:01

Sindre Sorhus