Use Rails-assets/Bower/NPM/Grunt/Gulp/BitLab to track and install frontend dependencies
Use Rails-assets to track our frontend dependencies. Bower is a package manager which uses a bower.json
file (similar to a gemfile
) to instruct bower install
what to install along with which versions. Rails assets will take bower packages and create gems out of them so we can use them as normal. This is good for a number of reasons:
- We can track which versions of external libraries we are using. Which we should be doing anyway.
- If a user decides not to use
bundle
to install, they will know which version of frontend libraries we require. - We can easily update our JS libs without doing manual file replacement. Just a version number change in
gemfile
and abower install
again. - We will be able to open source individual js components we create so others can use them, like
gl_dropdown.js
. - And many more...
There are many ways to skin a cat and we have to find the one that fits best with us.
This solution came after a chat with @marin, @dzaporozhets and @axil.
cc @marin @axil @dzaporozhets @iamphill @alfredo1 @elvongray
Update 1
After team discussion on 2016/09/06 we've decided to create a PoC for asset management through npm so we can more meaningfully discuss the pros and cons of this approach.
Also closing related issues (#20675 (closed) and #19713 (closed)) in favor of this one for future discussion.
Related document:
current list of non-gem frontend deps (@lbennett)