Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Just cherry-picked fixes for asset precompile for 3-1-stable #6152

Merged
merged 2 commits into from

3 participants

@route

No description provided.

@jeremy jeremy merged commit a33d9f4 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
3  actionpack/lib/sprockets/static_compiler.rb
@@ -16,6 +16,9 @@ def initialize(env, target, paths, options = {})
def compile
manifest = {}
env.each_logical_path do |logical_path|
+ if File.basename(logical_path)[/[^\.]+/, 0] == 'index'
+ logical_path.sub!(/\/index\./, '.')
+ end
next unless compile_path?(logical_path)
if asset = env.find_asset(logical_path)
manifest[logical_path] = write_asset(asset)
View
9 railties/test/application/assets_test.rb
@@ -114,6 +114,15 @@ def precompile!
assert !File.exists?("#{app_path}/public/assets/something.else.css")
end
+ test "precompile something.js for directory containing index file" do
+ add_to_config "config.assets.precompile = [ 'something.js' ]"
+ app_file "app/assets/javascripts/something/index.js.erb", "alert();"
+
+ precompile!
+
+ assert File.exists?("#{app_path}/public/assets/something.js")
+ end
+
test "asset pipeline should use a Sprockets::Index when config.assets.digest is true" do
add_to_config "config.assets.digest = true"
add_to_config "config.action_controller.perform_caching = false"
Something went wrong with that request. Please try again.