mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Default precompile regexp that properly matches application.js and application.css
This commit is contained in:
parent
18116791d0
commit
6e63e029b3
2 changed files with 10 additions and 1 deletions
|
@ -38,7 +38,7 @@ module Rails
|
||||||
@assets.enabled = false
|
@assets.enabled = false
|
||||||
@assets.paths = []
|
@assets.paths = []
|
||||||
@assets.precompile = [ Proc.new{ |path| !File.extname(path).in?(['.js', '.css']) },
|
@assets.precompile = [ Proc.new{ |path| !File.extname(path).in?(['.js', '.css']) },
|
||||||
/application.(css|js)$/ ]
|
/(?:\/|\\|\A)application\.(css|js)$/ ]
|
||||||
@assets.prefix = "/assets"
|
@assets.prefix = "/assets"
|
||||||
@assets.version = ''
|
@assets.version = ''
|
||||||
@assets.debug = false
|
@assets.debug = false
|
||||||
|
|
|
@ -68,6 +68,10 @@ module ApplicationTests
|
||||||
test "precompile application.js and application.css and all other files not ending with .js or .css by default" do
|
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/javascripts/application.js", "alert();"
|
||||||
app_file "app/assets/stylesheets/application.css", "body{}"
|
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/javascripts/something.min.js", "alert();"
|
||||||
app_file "app/assets/stylesheets/something.min.css", "body{}"
|
app_file "app/assets/stylesheets/something.min.css", "body{}"
|
||||||
|
|
||||||
|
@ -87,8 +91,13 @@ module ApplicationTests
|
||||||
images_should_compile.each do |filename|
|
images_should_compile.each do |filename|
|
||||||
assert File.exists?("#{app_path}/public/assets/#{filename}")
|
assert File.exists?("#{app_path}/public/assets/#{filename}")
|
||||||
end
|
end
|
||||||
|
|
||||||
assert File.exists?("#{app_path}/public/assets/application.js")
|
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/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.js")
|
||||||
assert !File.exists?("#{app_path}/public/assets/something.min.css")
|
assert !File.exists?("#{app_path}/public/assets/something.min.css")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue