I've started working with bower
, and it seems really helpful. I come from a python background, and so I'm used to having virtualenv
and requirements.txt
.
Since I'd rather not store all my dependencies in source control if I can help it, I was wondering, how can I create a file like requirements.txt
with bower
?
After poking around a bit more, I have the solution.
bower
uses a file called bower.json
(formerly component.json
) which is similar to a Gemfile
or requirements.txt
.
It can be created manually, and will look something like this...
{
"name": "<app name, defaults co current folder name>",
"version": "0.0.0",
"dependencies": {
"backbone": "~0.9.10",
"underscore": "~1.4.3"
}
}
However, the piece that I was missing was to include the --save
flag when installing packages in bower
:
bower install <package_name> --save
Unfortunately, I do not believe there is a way to set this behaviour by default using the .bowerrc
file.
As an added tidbit, once you have a bower.json
file, installing your dependencies is as simple as running bower install
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With