我在 production.rb 中有以下配置
# 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
但是当生产服务器上的 ruby on rails 应用程序出现以下错误时:
Error compiling CSS asset
LoadError: cannot load such file -- yui-compressor
在评论线上LoadError: cannot load such file -- yui-compressor
,一切顺利。
我只需要一个压缩器,它可以在发送之前压缩资产以提高性能!
那么,这里有什么问题,或者还有其他选择吗?
更新:
javascript压缩也不起作用,因为firefox的yslow插件也显示需要压缩javascripts。