What is Bower?
Bower is a package manager for front-end frameworks.
Why should I use Bower?
It’s arguably simpler to use Bower as your package manager for front-end development than to use NuGet.
- It can create a bower.json file that lists all of your dependencies.
- It’s easily driven from the command line.
- It separates out the concerns of the front-end from those of the back-end.
Starting with ASP.NET 5.0 there will be no more NuGet packages for front-end frameworks like Twitter Bootstrap. Microsoft currently create these packages using Bower but will now be expecting you to tool up with Bower yourself. Might as well get started early.
How do I use Bower?
This gets a bit gnarly, mainly because we’re behind a corporate proxy that expects authentication and tools like npm and bower aren’t clued up about that. You need to set up a proxy server locally to handle NTLM authentication. I’ve been successful with CNTLM.
- set up CNTLM
- install node (.msi)
- set up .npmrc
$ npm install -g npm
%ProgramFiles%\nodejsin the PATH
(npm wiki: upgrading-on-windows)
$ npm install -g bower
- set up .bowerrc
$ bower install bootstrap
You can now reference your bower_components directly from your includes or you can configure a Gulp/Grunt build.