Browse files

Now accepting css/js files in deeper directory structures by default.

This is useful for engines with own application.{js|css}-files.
See: #1520
  • Loading branch information...
1 parent cb99c85 commit 139971d3cc06168a69617a61058240afe227af99 @tobsch tobsch committed Jul 1, 2011
Showing with 8 additions and 5 deletions.
  1. +1 −1 railties/lib/rails/application/configuration.rb
  2. +7 −4 railties/test/application/assets_test.rb
View
2 railties/lib/rails/application/configuration.rb
@@ -34,7 +34,7 @@ def initialize(*)
@assets = ActiveSupport::OrderedOptions.new
@assets.enabled = false
@assets.paths = []
- @assets.precompile = [ /\w+\.(?!js|css).+/, "application.js", "application.css" ]
+ @assets.precompile = [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ]
@assets.prefix = "/assets"
@assets.js_compressor = nil
View
11 railties/test/application/assets_test.rb
@@ -37,14 +37,17 @@ def app
test "assets are compiled properly" do
app_file "app/assets/javascripts/application.js", "alert();"
+ app_file "app/assets/javascripts/foo/application.js", "alert();"
capture(:stdout) do
Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
end
-
- file = Dir["#{app_path}/public/assets/application-*.js"][0]
- assert_not_nil file, "Expected application.js asset to be generated, but none found"
- assert_equal "alert();\n", File.read(file)
+ files = Dir["#{app_path}/public/assets/application-*.js"]
+ files << Dir["#{app_path}/public/assets/foo/application-*.js"].first
+ files.each do |file|
+ assert_not_nil file, "Expected application.js asset to be generated, but none found"
+ assert_equal "alert();\n", File.read(file)
+ end
end
test "assets are cleaned up properly" do

0 comments on commit 139971d

Please sign in to comment.