捆绑程序如何处理 Rails 3.1 中的 :assets 组?
我不明白这个组到底发生了什么,以及捆绑器正在用它做什么。它只在开发模式下加载吗?如果我想创建一个新的环境类型,我应该如何处理这个组? ETC。
group :assets do
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
I don't understand what exactly is going on with this group, and what bundler is doing with it. Is it only loaded in dev mode? What if I want to make a new environment type, how should I handle this group? Etc.
group :assets do
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
处理
:assets
组的代码放置在config\application.rb
中。在 Rails 3.1 中是:The code that handles
:assets
group placed inconfig\application.rb
. In rails 3.1 it is:要详细说明答案,请参阅 rails 资产管道指南:
a)默认情况下,它们不包含在生产中:
b)如果添加新的环境类型,您将需要根据上面德米特里的回答来处理它。也就是说,将其添加为需要它的组之一。
To elaborate a little on the answer, from rails asset pipeline guide:
a) by default they are NOT included in production:
b) If you add a new environment type, you would want to handle it according to Dmitry's answer above. That is, add it as one of the groups that will require it.
我认为应该是,
因为该行有一些警告,
所以我们使用,
希望这有帮助:)-
I think it should be,
because there are some warning with the line,
So we use,
Hope this helps :)-