Last active
December 18, 2015 04:39
-
-
Save jugyo/5727487 to your computer and use it in GitHub Desktop.
a fix for performance improvement for the javascript_include_tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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