我在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
之后,一切都很顺利。
我需要一个压缩器,在发送资产之前对其进行gzip压缩以提高性能!
那么,问题出在哪里,或者是否有其他替代方案?
更新:
同样,JavaScript压缩也不起作用,因为Firefox的yslow插件还显示需要压缩JavaScript。
bundle install
。但是irb也显示相同的错误。 - Chirag Rupani