Sha256: 4e422ce4fe28fc2b1ff2e17dd1f6096ffb1b5baf8de93407083e7e809be1f895

Contents?: true

Size: 736 Bytes

Versions: 3

Compression:

Stored size: 736 Bytes

Contents

require "crush/engine"

module Crush
  module Closure
    # Engine implementation of Google's Closure Compiler,
    # using the closure-compiler gem. See:
    #
    # https://rubygems.org/gems/closure-compiler
    class Compiler < Crush::Engine
      self.default_mime_type = "application/javascript"
      
      def self.engine_initialized?
        !!(defined?(::Closure) && defined?(::Closure::Compiler))
      end
    
      def initialize_engine
        require_template_library "closure-compiler"
      end
    
      def prepare
        @engine = ::Closure::Compiler.new(options)
        @output = nil
      end
    
      def evaluate(scope, locals, &block)
        @output ||= @engine.compile(data)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
crush-0.3.3 lib/crush/closure.rb
crush-0.3.2 lib/crush/closure.rb
crush-0.3.1 lib/crush/closure.rb