Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bower - How to install jquery.js only and not the whole package?

Tags:

jquery

bower

Using bower install jquery command what I get in jquery folder are dist folder with jquery.js and jquery.min.js, src folder with the whole bunch of js files that make up jquery, I suppose, bower.json and licence files. How could I install jquery.js or jquery.min.js only?

like image 857
gskalinskii Avatar asked Mar 17 '14 19:03

gskalinskii


People also ask

Where does bower install packages?

Installed packages will be placed in a bower_components directory. This is created in the folder which the bower program was executed. You can change this destination using the configuration options in a . bowerrc file.

How does bower install work?

Bower doesn't concatenate or minify code or do anything else - it just installs the right versions of the packages you need and their dependencies. To get started, Bower works by fetching and installing packages from all over, taking care of hunting, finding, downloading, and saving the stuff you're looking for.

Is bower deprecated?

Bower has been deprecated by its creators After a long and heated debate on Github, the creators of Bower decided it does not add value to the current web development stack and should be discontinued.

What is bower package?

Bower is a package manager for client-side libraries and components that contain HTML, CSS, JavaScript, fonts, image files, and so on. You can install, locate, upgrade, and remove Bower packages without leaving WebStorm, on the dedicated Bower page or from the command line in the built-in terminal.


2 Answers

You can use bower-installer and an extra "install" section in your bower.json file like:

{     "name": "test",     "version": "0.0.0",     "dependencies": {         "jquery": "1.11.1",         "normalize-css": "latest"     },     "install" : {         "path"  : {             "js": "_js/",             "css": "_css/"         }     } } 

With that "install" section you can specify the install folder.
It than automatically creates the folders - if they're not existing - and installs just the required files like jquery.js or normalize.css to the specified "css" or "js" folder.

like image 56
Yves Avatar answered Sep 21 '22 01:09

Yves


From the jQuery download page:

The jQuery Bower package contains additional files besides the default distribution. In most cases you can ignore these files, however if you wish to download the default release on it's own you can use Bower to install jQuery from one of the above urls instead of the registered package. For example, if you wish to install just the compressed jQuery 2.1.0, you can install just that file with the following command:

bower install http://code.jquery.com/jquery-2.1.0.min.js

like image 44
Colin Avatar answered Sep 17 '22 01:09

Colin