大佬教程收集整理的这篇文章主要介绍了ruby-on-rails – 缺少gzip版本的css和js资产,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
您可以在预编译后通过gzipping资源自行恢复此功能,例如Xavier Noria使用find来使用find迭代资源文件夹中的所有css和js文件,然后使用Xargs将它们传递给gzip:
namespace :deploy do # it is important that we execute this after :normalize_assets because # ngx_http_gzip_static_module recommends that compressed and uncompressed # variants have the same mtime. Note that gzip(1) sets the mtime of the # compressed file after the original one automatically. after :normalize_assets,:gzip_assets do on release_roles(fetch(:assets_roles)) do assets_path = release_path.join('public',fetch(:assets_prefiX)) within assets_path do execute :find,". \\( -name '*.js' -o -name '*.css' \\) -exec test ! -e {}.gz \\; -print0 | xargs -r -P8 -0 gzip --keep --best --quiet" end end end end
以上是大佬教程为你收集整理的ruby-on-rails – 缺少gzip版本的css和js资产全部内容,希望文章能够帮你解决ruby-on-rails – 缺少gzip版本的css和js资产所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。