Permalink
Browse files

Default precompile regexp that properly matches application.js and ap…

…plication.css
  • Loading branch information...
1 parent 1811679 commit 6e63e029b335b1a5dfce43c20de27ca6fae29fa4 @ay ay committed Sep 15, 2011
Showing with 10 additions and 1 deletion.
  1. +1 −1 railties/lib/rails/application/configuration.rb
  2. +9 −0 railties/test/application/assets_test.rb
@@ -38,7 +38,7 @@ def initialize(*)
@assets.enabled = false
@assets.paths = []
@assets.precompile = [ Proc.new{ |path| !File.extname(path).in?(['.js', '.css']) },
- /application.(css|js)$/ ]
+ /(?:\/|\\|\A)application\.(css|js)$/ ]
@assets.prefix = "/assets"
@assets.version = ''
@assets.debug = false
@@ -68,6 +68,10 @@ def app
test "precompile application.js and application.css and all other files not ending with .js or .css by default" do
app_file "app/assets/javascripts/application.js", "alert();"
app_file "app/assets/stylesheets/application.css", "body{}"
+
+ app_file "app/assets/javascripts/someapplication.js", "alert();"
+ app_file "app/assets/stylesheets/someapplication.css", "body{}"
+
app_file "app/assets/javascripts/something.min.js", "alert();"
app_file "app/assets/stylesheets/something.min.css", "body{}"
@@ -87,8 +91,13 @@ def app
images_should_compile.each do |filename|
assert File.exists?("#{app_path}/public/assets/#{filename}")
end
+
assert File.exists?("#{app_path}/public/assets/application.js")
assert File.exists?("#{app_path}/public/assets/application.css")
+
+ assert !File.exists?("#{app_path}/public/assets/someapplication.js")
+ assert !File.exists?("#{app_path}/public/assets/someapplication.css")
+
assert !File.exists?("#{app_path}/public/assets/something.min.js")
assert !File.exists?("#{app_path}/public/assets/something.min.css")
end

0 comments on commit 6e63e02

Please sign in to comment.