Skip to content

Fixed assets loading performance in 3.2.13 #9820

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 20, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions actionpack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## unreleased ##

* Fixed assets loading performance in 3.2.13.

The PR #8756 uses Sprockets for resolving files that already exists on disk, for those files their extensions don't need to be rewritten. Fixes #9803.

*Fred Wu*

* `ActiveSupport::NumberHelper#number_to_human` returns the number unaltered when
the units hash does not contain the needed key, e.g. when the number provided is less
than the largest key proivided.
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/sprockets/helpers/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def rewrite_extension(source, dir, ext)
source
elsif source_ext.blank?
"#{source}.#{ext}"
elsif exact_match_present?(source)
elsif File.exists?(source) || exact_match_present?(source)
source
else
"#{source}.#{ext}"
Expand Down
9 changes: 9 additions & 0 deletions actionpack/test/template/sprockets_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ def compute_host(source, request, options = {})
assert_nothing_raised { javascript_include_tag('foo.min') }
end

test "assets that exist on filesystem don't need to go through Sprockets" do
@config.assets.digest = false
@config.assets.debug = true

Rails.application.assets.expects(:resolve).never

asset_paths.asset_for(FIXTURES.join("sprockets/app/javascripts/foo.min.js").to_path, 'min')
end

test "stylesheet path through asset_path" do
assert_match %r{/assets/application-[0-9a-f]+.css}, asset_path(:application, :ext => "css")

Expand Down