Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to use Bower to Install Bootstrap

Bower is a popular package manager to help you quickly deploy components. In this article I’m going to show you how to Install Bower and how to use it to install Bootstrap.

Pre-requisites: To install Bower you must first have Node.js and npm (another package manager) installed, your computer may have shipped with these pre-installed. To check if you have npm, open your command-line tool and type:

npm -v

If you do not get a version number, you may need to install npm which comes pre-packaged with Node.js

You can find Node.js along with instructions on how-to install it here: https://nodejs.org/en/

Windows Users Only: If you’re a Windows user make sure you have Git for Windows installed to work with the Windows Command Prompt with Checkout Windows-Style and commit Unix-style line endings. You can find more information on that here: https://git-for-windows.github.io

Installation:

Provided that you have both Node.js and npm installed, run the following command in your Command-line tool:

npm install -g bower

Usage:

Once Bower is installed it’s as easy as going to your project folder in Command-line and typing:

bower install bootstrap

This will install the files required for Boostrap in the newly created ‘bower_components’ folder.

In this folder you will have 2 new folders ‘bootstrap’ and ‘jquery’.

jQuery will be automatically downloaded by Bower as it’s required for running Bootstrap.

The next step is to include the files for both bootstrap and jQuery into your project file(s).

That’s it, you should be good to go.
 

Updating

If you need to update a project and are unsure which bower packages you have installed that might need an update, you can type

bower list

in your project directory for a listing of packages you installed via Bower and which ones are due for an update.

in this case if we wanted to update our bootstrap install we would do:

bower update bootstrap

Making your Bower configurations portable

Once you have figured out your configurations and installed all of your desired Bower packages you can use:

bower init

Follow the steps provided in your Command-line.

This will initialize a bower.json file which will store your configurations.

Once you have your Bower.json file you can move it around to other locations or projects and you can get Bower to reinstall all of your packages and configurations by typing:

bower install

This will get Bower to create another ‘bower_components’ folder with the same packages and configurations specified in your bower.json file.

For further information on using or configuring Bower You can checkout the official website



This post first appeared on LoginRadius | Engineering, please read the originial post: here

Share the post

How to use Bower to Install Bootstrap

×

Subscribe to Loginradius | Engineering

Get updates delivered right to your inbox!

Thank you for your subscription

×