Dev Notes

Various Cheat Sheets and Resources by David Egan/Carawebs.

Install a Dev Branch with Bower


Bootstrap, Bower
David Egan

I decided to try out the Bootstrap 4 CSS framework on this website. It’s still in Alpha, and not recommended for production sites.

I wanted to install Bootstrap by means of Bower. You normally install via Bower by moving to the project root directory and entering:

bower install <package> --save-dev

In the case of Bootstrap, you’d enter:

bower install bootstrap --save-dev

The Bootstrap assets would be downloaded and automatically added to a bower_components directory in your project.

package.json

The --save-dev flag adds the package as a project dependency in your bower.json file - so running bower install against your project will install the package you’ve just added.

If you don’t have a bower.json file, you can run bower init to generate one.

This method fetches the latest stable version, so it’s no good for fetching the Bootstrap 4 development branch.

Install endpoints

Fortunately, there are a range of endpoints for the install command. You can install a package version - a valid range, commit or branch by means of bower install <package>#<version>.

  • <package> refers to a package URL, physical location or Bower registry name.
  • <version> can be a:
    • semver version (#1.2.3)
    • version range
    • git tag
    • git commit SHA
    • git branch

Install Bootstrap 4 Dev Branch

Determine the relevant branch (via GitHub) and add it as an endpoint:

bower install bootstrap#v4-dev --save-dev

Resources


comments powered by Disqus