require "rake-pipeline" require "rake-pipeline/middleware" require "rake-pipeline-web-filters" # Rake::Pipeline extension module Middleman::Pipeline # Setup extension class << self # Once registered def registered(app, options={}) app.after_configuration do ::Middleman::Sitemap::Resource.send :include, ResourceInstanceMethods asset_file = options[:Assetfile] || File.expand_path("Assetfile", root) input_path = options[:input] || "assets" # Pass along details to filter ::Middleman::Pipeline::Filter.instance = self ::Middleman::Pipeline::Filter.input_path = input_path if asset_file.is_a?(String) begin pipeline_source = File.read(asset_file) if pipeline_source =~ /^input/ puts "== Warning: Do not include 'input' directive in Assetfile" end if pipeline_source =~ /^output/ puts "== Warning: Do not include 'output' directive in Assetfile" end full_input_path = File.expand_path(input_path, source_dir) full_output_path = File.expand_path(".pipeline-tmp", root) final_asset_source = <