rake资产之间的区别是什么:precompile和RAILS_ENV =生产佣金资产:预编译?

dfa*_*ang 2 assets ruby-on-rails

这两个任务之间有什么区别,为什么我需要在上限部署时添加RAILS_ENV =生产?

谢谢!

And*_*nih 6

您需要指定RAILS_ENV=production环境变量,以便config/environments/production.rb在预编译资产时使用配置文件.它通常包含资产管道的生产配置:

config.assets.js_compressor = :uglifier
config.assets.digest = true
Run Code Online (Sandbox Code Playgroud)

如果省略RAILS_ENV=production则将使用development配置(config/environments/development.rb).