BOWER for front-end package managment

  • Post author:
  • Post category:General
BOWER for front-end package managment

 

Bower is a set in stone solution to the problem of front-end package management. For web applications, it is a good choice. Building up websites required a lot of package managers like Composer and NPM, which have proved efficient. They help in simplifying the installation and updation of package dependencies.

The website comprises CSS frameworks like bootstrap, Java script frameworks like angular and libraries like jQuery. Bower helps in managing all these. It doesn’t confuse the objective of the browser by minimising the code of your applications. This helps in installing the right version of packages and dependencies that are required. The browser actually downloads into a particular location, the source libraries for the right libraries, and everything that is needed. It helps in keeping track of the installed packages and aids in upgrading packages.  The developer can decide how to use them.  

Bower requires having three requisites installed on the server.

* NodeJS

* NPM

* Git

Bower uses Node. It is better to install nodeJS prior to using Bower. For a Windows machine, the best way to install nodeJS is to use any installer from the website. For Linux distributions, you can either go for the installer or the binary distributions.

The version can be checked as

# node -v.

Node comes along with NPM. So there is no need for any extra installation.

The version check can be done by executing npm -v. As NPM gets more frequently updated it is better to ensure that the latest version is getting executed.

# npm install npm@latest -g.

Also Git needs to be installed as bower packages are Git repos. Git may be required to install and fetch some packages. With these requirements, one can proceed to install Git globally.

# npm install -g bower

Bower uses a special file called bower.json to keep track of all the dependencies that are used in the application. A bower.json file can be created by using

# bower init

Another important file is .bowerrc . It can be used to change the name and the location of the bower_components directory. By default, Bower downloads everything to the bower_components folder.

It looks like

{

 “directory”: “/components”

}

Installing packages can be attained by

# bower install <package>

These packages will be installed to  bower_components/. To install a package and adds it to bower.json –save option can be used as follows:

# bower install <package> –save

You can gather the list of all packages by using the list option.

# bower list

To view the details of a particular package, you need to specify the package name along with the info option.

# bower info <package-name>

Another interesting aspect is that Bower does not require super user permissions, as it is a user command.
The package manager feature has recasted the way the code is shared. Bower has introduced a hassle free way of managing project libraries and dependencies. Undoubtedly, bower is an excellent tool that the developers can often resort to.

 

Leave a Reply