Module: Sprockets::EcoProcessor

Defined in:
lib/sprockets/eco_processor.rb

Overview

Processor engine class for the Eco compiler. Depends on the `eco` gem.

For more infomation see:

https://github.com/sstephenson/ruby-eco
https://github.com/sstephenson/eco

Constant Summary collapse

VERSION =
'1'

Class Method Summary collapse

Class Method Details

.call(input) ⇒ Object

Compile template data with Eco compiler.

Returns a JS function definition String. The result should be assigned to a JS variable.

# => "function(...) {...}"


21
22
23
24
25
26
27
# File 'lib/sprockets/eco_processor.rb', line 21

def self.call(input)
  data = input[:data]
  key  = [self.name, ::Eco::Source::VERSION, VERSION, data]
  input[:cache].fetch(key) do
    ::Eco.compile(data)
  end
end