Get rid of build_reroute. The last thing using it was the sprockets extension, though it didn't appear to need it since removing the build_reroute call leaves tests passing, and the test site I tried still generated JS from CoffeeScript just fine.
This commit is contained in:
parent
57061a17c0
commit
382107d403
|
@ -6,45 +6,7 @@ module Middleman::CoreExtensions::Builder
|
|||
# @private
|
||||
def registered(app)
|
||||
app.define_hook :after_build
|
||||
app.extend ClassMethods
|
||||
app.send :include, InstanceMethods
|
||||
app.delegate :build_reroute, :to => :"self.class"
|
||||
end
|
||||
alias :included :registered
|
||||
end
|
||||
|
||||
# Build Class Methods
|
||||
module ClassMethods
|
||||
# Get a list of callbacks which can modify a files build path
|
||||
# Each callback takes a destination path and a request path and
|
||||
# returns a new destination path, or false if it doesn't want to reroute.
|
||||
# @return [Array<Proc>]
|
||||
def build_reroute(&block)
|
||||
@build_rerouters ||= []
|
||||
@build_rerouters << block if block_given?
|
||||
@build_rerouters
|
||||
end
|
||||
end
|
||||
|
||||
# Build Instance Methods
|
||||
module InstanceMethods
|
||||
# Run through callbacks and get the new values
|
||||
#
|
||||
# @param [String] destination The current destination path of the built file
|
||||
# @param [String] request_path The request path of the file
|
||||
# @return [String] The new destination path
|
||||
def reroute_builder(destination, request_path)
|
||||
result = [destination, request_path]
|
||||
|
||||
build_reroute.each do |block|
|
||||
output = block.call(destination, request_path)
|
||||
if output
|
||||
result = output
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,18 +13,6 @@ module Middleman::CoreExtensions::Sprockets
|
|||
app.set :js_compressor, false
|
||||
app.set :css_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
|
||||
|
||||
# Once Middleman is setup
|
||||
app.ready do
|
||||
# Create sprockets env for JS
|
||||
|
@ -172,4 +160,4 @@ module Middleman::CoreExtensions::Sprockets
|
|||
super(exception)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue