Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #6152 from route/assets_precompile_task_3_1

Just cherry-picked fixes for asset precompile for 3-1-stable
  • Loading branch information...
commit a33d9f435c6be4246661ae56a7e80c526e777c5f 2 parents 0cfa6b7 + 29aa03a
@jeremy jeremy authored
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"
Please sign in to comment.
Something went wrong with that request. Please try again.