Skip to content

Instantly share code, notes, and snippets.

@jugyo
Last active December 18, 2015 04:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugyo/5727487 to your computer and use it in GitHub Desktop.
Save jugyo/5727487 to your computer and use it in GitHub Desktop.
a fix for performance improvement for the javascript_include_tag
# fix assets loading performance in 3.2.13
# see:
# * https://github.com/rails/rails/commit/687e68d88f5e1a7bb6a2d876fbbc5b8c4571d853
# * https://github.com/rails/rails/issues/9803
if Rails.env.development? && Rails.version == "3.2.13"
module Sprockets
module Helpers
module RailsHelper
class AssetPaths
def rewrite_extension(source, dir, ext)
source_ext = File.extname(source)[1..-1]
if !ext || ext == source_ext
source
elsif source_ext.blank?
"#{source}.#{ext}"
elsif File.exists?(source) || exact_match_present?(source)
source
else
"#{source}.#{ext}"
end
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment