The best way to manage Rails front-end frameworks and libraries

08 Mar, 2015Rails

For Node.js, Bower is a popular tool for managing various frameworks. for Rails, the normal method is to find the corresponding front-end framework on RubyGems Gem, and add it to Gemfile. But this method does not solve the dependencies very well, and most of this Gem It is developed by a third-party developer and does not guarantee the authenticity of the framework and synchronization with the latest version.

Later I found a website: Rails Assets can solve this problem well, which is equivalent to The bridge between Bundler and Bower. Search directly for the required framework name, add it to the Gemfile according to the installation instructions, and run Bundle Install, and then reference the framework in application.js, application.css or other places.

Update 2015-03-13:

Facts have proved that this method is not necessarily bad, for example, it needs to be used in a Rails application recently. Semantic UI, start using rails-assets-semantic-ui this gem, but because the Semantic UI in this gem is already compiled, you need to adjust the compilation parameters and find it difficult to do so, you need to install it Look for it in the gem directory, and it doesn't work if you try to change it. So in the end, I downloaded it from Semantic UI official website, compiled it myself, and put it in vendor/assets, then in app/assets/javascripts/application.js and Just configure and import in app/assets/stylesheets/application.css. For details, please refer to Asset Pipeline.


Powered by Gatsby. Theme inspired by end2end.

© 2014-2021. Made withby mdluo.