Permalink
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...
2 parents 0cfa6b7 + 29aa03a commit a33d9f435c6be4246661ae56a7e80c526e777c5f @jeremy jeremy committed May 4, 2012
Showing with 12 additions and 0 deletions.
  1. +3 −0 actionpack/lib/sprockets/static_compiler.rb
  2. +9 −0 railties/test/application/assets_test.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)
@@ -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"

0 comments on commit a33d9f4

Please sign in to comment.