I'm experimenting with yeoman and bower.
I have created a yeoman webapp using the following command
yo webapp
I want to use jqueryui so I have installed it using bower:
bower install jquery-ui --save
This works fine, but the jQuery UI component doesn't contain a javascript file with "all" the components, it just contains a lot of javascript files, one for each component.
Should I include only the javascript files that I need? Or should I do something else before using jQuery UI?
Thanks for the tips!
Added
jquery-ui
independencies
ofbower.json
(orcomponent.json
) along withjquery
.Install them:
Then, added path to
jqueryui
Inmain.js
and require it:It works for me.
You could use requirejs.config's shim property to achieve your goal:
We specified, that jquery.ui.sortable, when required in your project, needs to load and execute the modules listed under
deps
first, before being executed itself.Unfortunately, this still produces a race condition... But that is generally how one would go about this (:
For reference,
bower install jquery-ui --save
would add thejquery-ui.js
dependency to the project, but not the styles. For that I needed to add to thebower.json
file anoverrides
section, as belowReferences:
https://stackoverflow.com/a/27419553/4126114
https://github.com/taptapship/wiredep/issues/86
In the latest jQuery UI bower component as we speak (v. 1.10.3), you can do the following:
For the CSS themes, include the following link:
<link rel="stylesheet" href="bower_components_path/jquery-ui/themes/base/jquery-ui.css">
To get the most components and widgets of jQueryUI running, include the following script:
<script src="bower_components_path/jquery-ui/ui/jquery-ui.js" ></script>
I would just include the files that I need or use the default custom build in the folder (which I believe has all the components) if you require everything or if it's just for experimentation.
At this time bower pulls down the entire repo and since (from their website) "bower is just a package manager" anything else needed like concatenation or module loading is handled by other tools like sprockets/requirejs.
References:
Using packages with bower on homepage http://bower.io/
Dissusion about bower and pulling entire repos https://github.com/bower/bower/issues/45