diff --git a/middleman-core/lib/middleman-core/core_extensions/builder.rb b/middleman-core/lib/middleman-core/core_extensions/builder.rb index 7f67222b..4b901b69 100644 --- a/middleman-core/lib/middleman-core/core_extensions/builder.rb +++ b/middleman-core/lib/middleman-core/core_extensions/builder.rb @@ -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] - 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 diff --git a/middleman-more/lib/middleman-more/core_extensions/sprockets.rb b/middleman-more/lib/middleman-more/core_extensions/sprockets.rb index 370534ea..cc1acaf8 100644 --- a/middleman-more/lib/middleman-more/core_extensions/sprockets.rb +++ b/middleman-more/lib/middleman-more/core_extensions/sprockets.rb @@ -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 \ No newline at end of file +end