Class: Embork::Sprockets::ClosureCompiler

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/embork/sprockets/closure_compiler.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compilerObject



11
12
13
14
15
16
17
# File 'lib/embork/sprockets/closure_compiler.rb', line 11

def self.compiler
  require 'closure-compiler'
  @compiler ||= Closure::Compiler.new(
    :jar_file => File.expand_path('../support/closure_compiler.jar', __FILE__),
    :compilation_level => 'SIMPLE'
  )
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



19
20
21
22
# File 'lib/embork/sprockets/closure_compiler.rb', line 19

def evaluate(scope, locals, &block)
  @logger.info 'Compressing %s.js with the closure compiler' % scope.logical_path
  self.class.compiler.compile data
end

#prepareObject



7
8
9
# File 'lib/embork/sprockets/closure_compiler.rb', line 7

def prepare
  @logger = Embork::Logger.new STDOUT, :simple
end