Bower can be configured using JSON in a .bowerrc file. For example:
Placement & Order
The config is obtained by merging multiple configurations by this order of importance:
- CLI arguments via
- Environment variables
.bowerrclocated in the current working directory
.bowerrcfiles upwards the directory tree
.bowerrcfile located in user’s home folder (
.bowerrcfile located in the global folder (
Example of CLI arguments:
Example of valid environment variables:
bower_endpoint_parseris evaluated as
bower_storage__packagesis evaluated as
Example of valid environment variables with Array convention:
export bower_registry__search='[http://localhost:8080, http://registry.bower.io]'; bower install
Available configuration variables, in
A detailed description of available configuration variables can be found in bower/spec repository.
Environment variables in .bowerrc
One can use environment variables in
.bowerrc, using the following syntax
Bower provides 3 separate hooks that can be used to trigger other automated tools during Bower usage. Importantly, these hooks are intended to allow external tools to help wire up the newly installed components into the parent project and other similar tasks. These hooks are not intended to provide a post-installation build step for component authors. As such, the configuration for these hooks is provided in the
.bowerrc file in the parent project’s directory.
The value of each script hook may contain a % character. When your script is called, the % will be replaced with a space-separated list of components being installed or uninstalled.
Your script will also include an environment variable
BOWER_PID containing the PID of the parent Bower process that triggered the script. This can be used to verify that a
postinstall steps are part of the same Bower process.