我對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