我对 RoR 比较陌生,我很好奇为什么 Rails 会编译带有和不带有 md5 哈希的资产以用于生产?
bundle exec rake assets:clean
然后我跑bundle exec rake assets:precompile
我的 production.rb 文件:
MyApp::Application.configure do
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
config.assets.precompile += %w(tos.js, tos.css)
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
end
我的应用程序使用名称中带有哈希的文件,这在我的情况下应该是这样:)
所以我在这里有两个问题:
1)为什么编译时会发生?
Rails 编译带有和不带有 md5 哈希的资产以用于生产
2)这些文件(没有哈希)是做什么用的?
也许我没有得到什么,所以请有人解释一下。