Sha256: 0625fe0db07fdc37256d9a8ed703439fc3ac0081ab74cf90a0d501820ea7f014
Contents?: true
Size: 870 Bytes
Versions: 16
Compression:
Stored size: 870 Bytes
Contents
module Enjoy::GzipHelper def gzip_javascript_include_tag(*sources) # Grab the asset html include tag tag = javascript_include_tag *sources # If we are in production and the requesting client accepts gzip encoding, swap for the gzip asset if Rails.env.production? && request.accept_encoding =~ /gzip/i tag = tag.gsub(/\.js/i, ".js.gz") end # Return the asset whether or not it was modified tag.html_safe end def gzip_stylesheet_link_tag(*sources) # Grab the asset html include tag tag = stylesheet_link_tag *sources # If we are in production and the requesting client accepts gzip encoding, swap for the gzip asset if Rails.env.production? && request.accept_encoding =~ /gzip/i tag = tag.gsub(/\.css/i, ".css.gz") end # Return the asset whether or not it was modified tag.html_safe end end
Version data entries
16 entries across 16 versions & 1 rubygems