Sha256: 9c5e3626e2a2ce856d64135d9daa397cf68f3a5dab85f5142c938aad71ae4857
Contents?: true
Size: 1.08 KB
Versions: 27
Compression:
Stored size: 1.08 KB
Contents
# Require gem require "coffee_script" module Middleman module Renderers # CoffeeScript Renderer module CoffeeScript # Setup extension class << self # Once registered def registered(app) app.before_configuration do template_extensions :coffee => :js end # Tell Tilt to use it as well (for inline scss blocks) ::Tilt.register 'coffee', DebuggingCoffeeScriptTemplate ::Tilt.prefer(DebuggingCoffeeScriptTemplate) end alias :included :registered end # A Template for Tilt which outputs debug messages class DebuggingCoffeeScriptTemplate < ::Tilt::CoffeeScriptTemplate # Add exception messaging # @param [Class] context # @param [Hash] locals # @return [String] def evaluate(context, locals, &block) return super if context.build? begin super rescue ::ExecJS::RuntimeError => e e.to_s rescue => e e.to_s end end end end end end
Version data entries
27 entries across 27 versions & 2 rubygems