Why is 'jQuery-Rails' often outside of the asset group

假如想象 提交于 2019-12-22 02:03:14

问题


Why is it that I often see gem 'jquery-rails outside of the :assets group?

group :assets do
  gem 'sass-rails', " ~> 3.1.0"
  gem 'coffee-rails', " ~> 3.1.0"
  gem 'uglifier'
end

gem 'jquery-rails'

Will there be buggy behavior if I put it inside?

Thanks!


回答1:


The jquery-rails gem provides some test helpers also. So perhaps for that reason people prefer to put it outside the :assets group.

However, the :assets group is included in development and testing environment, so you should be perfectly safe to place jquery-rails in your :assets group if you like.

Just make sure you precompile your assets before you deploy your application.




回答2:


The real answer for this is that gem 'jquery-rails' can often break up on the production, and there would be no standard way of fixing this other then initializing the gem itself from the beginning. I have seen this problems on heroku.

The fix for that is to put jquery-rails outside :assets group, and that way you would be sure that it will not break up.

Even the question is an old one, I wanted to make sure that that is the reason, and you would probably need to put 'jquery-rails' OUTSIDE :assets group.



来源:https://stackoverflow.com/questions/10730386/why-is-jquery-rails-often-outside-of-the-asset-group

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!