我对RoR相对比较陌生,我很好奇Rails为什么编译资产既有和没有md5散列用于生产?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)这些是什么文件(没有哈希)呢?
也许我没有得到什么东西,所以请有人解释。
你好,克里斯感谢你的回复和解释,我认为我有一些错误配置导致了这种行为。如果这种方式应该是这样的话,那就可以了。再次感谢。 – 2012-04-06 17:04:17
在事情的另一面,我的Rails安装与他的配置完全相同,但它只是编译带有指纹的资产,并没有编译没有指纹的版本。由于Chris Bailey列出的原因,这非常烦人。任何想法如何我可以解决这个问题? – NudeCanalTroll 2012-04-18 00:52:10
@NudeCanalTroll:你没有运行'rake assets:precompile:nondigest'。 – jpatokal 2012-11-20 04:44:51