module Middleman::ThorActions
def tilt_template(source, *args, &block)
def tilt_template(source, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} destination = args.first || source source = File.expand_path(find_in_source_paths(source.to_s)) context = instance_eval('binding') @@rack_test ||= ::Rack::Test::Session.new(::Rack::MockSession.new(Middleman::Server)) create_file destination, nil, config do # The default render just requests the page over Rack and writes the response request_path = destination.gsub(Middleman::Server.build_dir, "") @@rack_test.get(request_path) @@rack_test.last_response.body end end