我有以下的production.rbon Rails的壓縮資產紅寶石3
# 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
# Choose the compressors to use
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :yui
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs.
config.assets.digest = true
但是配置時,在生產服務器上的Rails應用程序的紅寶石我獲得以下錯誤:在註釋行
Error compiling CSS asset
LoadError: cannot load such file -- yui-compressor
LoadError: cannot load such file -- yui-compressor
,一切順利。
我只需要一個壓縮器,在發送之前將gzip壓縮資源以提高性能!
那麼,這裏有什麼問題或者是否有其他選擇?
更新:
同樣的JavaScript壓縮不工作,因爲需要壓縮的Firefox還顯示JavaScript的YSlow的插件。
是的,我已經在Gemfile中包含了yui-compressor gem並且運行bundle install.irb也顯示了相同的錯誤。 – usercr