Getting started with Bower

If you’re new to Bower, codementor has a great beginners guide. It gives you an introduction of what Bower is and walks you through the installation process.

  1. Download node from nodejs.org.
  2. Install Bower
    sudo npm install -g bower

    Note: I tried running the command without sudo and got the following error, and after searching on the web, found that it needs to be run with root access or permissions to install Bower globally.

    Please try running this command again as root/Administrator.
  3. As an example, use Bower to install jQuery. Navigate to your site root and run the following command:

    $ bower install jquery

    Note: To install a specific version, you can use

    bower install bootstrap#version_number

    Here’s the output

    ? May bower anonymously report usage statistics to improve the tool over time? (Y/n) bower jquery#* not-cached git://github.com/jquery/jquery.git#*
    bower jquery#* resolve git://github.com/jquery/jquery.git#*
    bower jquery#* download https://github.com/jquery/jquery/archive/2.1.4.tar.gz
    bower jquery#* extract archive.tar.gz
    bower jquery#* resolved git://github.com/jquery/jquery.git#2.1.4
    bower jquery#~2.1.4 install jquery#2.1.4

    jquery#2.1.4 bower_components/jquery

    Bower installed the package into a newly created folder called ‘bower_components’.
    Bower components

  4. To update the package, just run this command:

    $ bower update jquery

That’s it! Of course, there’s more to it. There are some really useful tips and tricks in this article at CSS-Tricks that I can’t wait to try. And the list of all the commands can be found on the Bower API site.

Leave a Reply