sprockets ignores extensions after .js in build mode. closes #110
This commit is contained in:
parent
cc577c0c73
commit
d7f39350d5
2 changed files with 19 additions and 2 deletions
|
@ -14,3 +14,8 @@ Feature: Sprockets
|
||||||
Given the Server is running at "test-app"
|
Given the Server is running at "test-app"
|
||||||
When I go to "/javascripts/multiple_engines.js"
|
When I go to "/javascripts/multiple_engines.js"
|
||||||
Then I should see "Hello One"
|
Then I should see "Hello One"
|
||||||
|
|
||||||
|
Scenario: Multiple engine files should build correctly
|
||||||
|
Given a built app at "test-app"
|
||||||
|
Then "javascripts/multiple_engines.js" should exist at "test-app" and include "Hello One"
|
||||||
|
And cleanup built app at "test-app"
|
|
@ -7,6 +7,18 @@ module Middleman::CoreExtensions::Sprockets
|
||||||
def registered(app)
|
def registered(app)
|
||||||
app.set :js_compressor, false
|
app.set :js_compressor, false
|
||||||
|
|
||||||
|
# Cut off every extension after .js (which sprockets eats up)
|
||||||
|
app.build_reroute do |destination, request_path|
|
||||||
|
if !request_path.match(/\.js\./i)
|
||||||
|
false
|
||||||
|
else
|
||||||
|
[
|
||||||
|
destination.gsub(/\.js(\..*)$/, ".js"),
|
||||||
|
request_path.gsub(/\.js(\..*)$/, ".js")
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
app.after_configuration do
|
app.after_configuration do
|
||||||
js_env = Middleman::CoreExtensions::Sprockets::JavascriptEnvironment.new(app)
|
js_env = Middleman::CoreExtensions::Sprockets::JavascriptEnvironment.new(app)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue