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!
Libraries are downloaded with Bower using the bower install command. To install jQuery UI, run bower install jquery-ui . Doing so creates the following (simplified) directory structure. Note: If you get an error that the bower command is not found, check out Bower's installation instructions.
Bower provides hooks to facilitate using packages in your tools and workflows. Bower is optimized for the front-end. If multiple packages depend on a package - jQuery for example - Bower will download jQuery just once. This is known as a flat dependency graph and it helps reduce page load.
Added jquery-ui
in dependencies
of bower.json
(or component.json
) along with jquery
.
{ …, "dependencies": { "jquery": "~1.9.1", "jquery-ui": "~1.10.3", ... }, … }
Install them:
bower install
Then, added path to jqueryui
In main.js
and require it:
require.config({ paths: { jquery: '../components/jquery/jquery', jqueryui: '../components/jquery-ui/ui/jquery-ui', … }, shim: { jqueryui: 'jquery', … }, … }); require(['app', 'jquery', 'jqueryui', 'bootstrap'], function (app, $) { 'use strict'; ... });
It works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With