I wanted to try out Bower in combination with my Aurora sub-theme, but I don't quite understand how it is supposed to work.

AFAIK I do understand the basics of Bower. I can use bower install to add a dependency, after which new files appear in bower_components and a new line shows up nicely in bower.json. So far so good.

However, the default .gitignore excludes the bower_components directory, so obviously I'm not supposed to commit the entire bower component in git. Is there some kind of build procedure I am not aware of?

Of course the js file(s) must also be included by the theme. Is simply adding it to stylesheets[all] in SUBTHEME.info considered "the right way"?

Thanks.

Comments

iamcarrico’s picture

Status: Active » Closed (works as designed)

Bower support is added merely as a convenience, please refer to documentation on Bower or the many tutorials on Bower for more detailed instructions on it's use.

bartvdputte’s picture

Bower only manages the version for each package you install.

Building them in your "build" is entirely up to you. E.g. if you download jQuery manually it's also not automagically included in your project/build process. You have to include it manually too in the necessary files.

Once you have a few dependencies installed via bower you'll notice its true potential updating them etc. Also: they are not included in your git repo as you noticed. Only the bower.json file is, but that file is powerful enough to include all necessary projects in their correct version with the run of "bower install" (you can test this if you completely erase all content of the bower_components directory and quickly run "bower install" afterwards. All projects inside bower.json will be re-added with the version stated inside bower.json).

marcvangend’s picture

OK, thanks for your responses. At least I didn't miss any automagic goodness :-)

I did notice that a bower install rebuilds all of your libraries. However if you don't commit them to git, it means that I'm adding yet another step to the build process. I think my non-frontend colleagues are not looking forward to that...