How is the :assets group in rails 3.1 handled by bundler?

后端 未结 3 1385
南方客
南方客 2020-12-29 06:52

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

3条回答
  •  佛祖请我去吃肉
    2020-12-29 07:26

    I think it should be,

    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
    

    because there are some warning with the line,

    Bundler.require *Rails.groups(:assets => %w(development test))
    

    So we use,

    Bundler.require(*Rails.groups(:assets => %w(development test)))
    

    Hope this helps :)-

提交回复
热议问题