module Sprockets::ProcessorUtils
def call_processors(processors, input)
input - Hash of input data to pass to each processor
processors - Array of processor callables
bundle.call(uglify.call(coffee.call(input)))
Think about:
The right to left order processing mirrors standard function composition.
Public: Invoke list of processors in right to left order.
def call_processors(processors, input) data = input[:data] || "" metadata = (input[:metadata] || {}).dup processors.reverse_each do |processor| result = call_processor(processor, input.merge(data: data, metadata: metadata)) data = result.delete(:data) metadata.merge!(result) end metadata.merge(data: data) end