Reputation: 36574
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?
Upvotes: 4
Views: 5538
Reputation: 181
You can also use npm for installing openlayers. https://www.npmjs.com/package/openlayers
npm install ol
Upvotes: -2
Reputation: 585
I had some 'fun' when it came to doing this,I included a referece to openLayers.js in my index.html when I ran grunt serve, the reference to Openlayers.js was removed, and wiredep reported an injection problem.
The issue was caused by suppled version of OpenLays not having a 'main' token defined.
This is how you fix it.
In your html file, say
<!-- build:js(.) scripts/vendor.js -->
<!-- bower:js -->
<script src="bower_components/openlayers/lib/OpenLayers.js"></script>
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/jquery-ui/jquery-ui.js"></script>
<!-- endbower -->
<!-- endbuild -->
In the bower.json file (mines in the project root) say
{
"name": "foobar",
"private": true,
"dependencies": {
"bootstrap": "~3.2.0",
"jquery-ui": "~1.11.2",
"jquery": "~2.1.1",
"openlayers": "1.0.0"
},
"overrides": {
"openlayers": {
"main": "lib/OpenLayers.js"
}
}
}
This defines the missing main token.
Upvotes: 2
Reputation: 11154
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.
Upvotes: 8
Reputation: 63487
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
.
Upvotes: 5