捆绑程序如何处理Rails

捆绑程序如何处理Rails

本文介绍了捆绑程序如何处理Rails 3.1中的:assets组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道该小组到底发生了什么,以及捆绑程序正在做什么。仅在开发模式下加载吗?如果要创建新的环境类型,该如何处理该组?

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


推荐答案

处理放置在 config\application.rb 中的:assets 组的代码。在rails 3.1中是:

The code that handles :assets group placed in config\application.rb. In rails 3.1 it is:

if defined?(Bundler)
  # If you precompile assets before deploying to production, use this line
  Bundler.require *Rails.groups(:assets => %w(development test))
  # If you want your assets lazily compiled in production, use this line
  # Bundler.require(:default, :assets, Rails.env)
end

这篇关于捆绑程序如何处理Rails 3.1中的:assets组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 06:52