module Sprockets::EcoProcessor

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

Constants

VERSION

Public Class Methods

cache_key() click to toggle source
# File lib/sprockets/eco_processor.rb, line 14
def self.cache_key
  @cache_key ||= "#{name}:#{Autoload::Eco::Source::VERSION}:#{VERSION}".freeze
end
call(input) click to toggle source

Compile template data with Eco compiler.

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

# => "function(...) {...}"
# File lib/sprockets/eco_processor.rb, line 25
def self.call(input)
  data = input[:data]
  input[:cache].fetch([cache_key, data]) do
    Autoload::Eco.compile(data)
  end
end