Module: Sprockets::CoffeeScriptProcessor

Defined in:
lib/sprockets/coffee_script_processor.rb

Overview

Processor engine class for the CoffeeScript compiler. Depends on the ‘coffee-script` and `coffee-script-source` gems.

For more infomation see:

https://github.com/josh/ruby-coffee-script

Constant Summary collapse

VERSION =
'1'

Class Method Summary collapse

Class Method Details

.cache_keyObject



14
15
16
# File 'lib/sprockets/coffee_script_processor.rb', line 14

def self.cache_key
  @cache_key ||= "#{name}:#{Autoload::CoffeeScript::Source.version}:#{VERSION}".freeze
end

.call(input) ⇒ Object



18
19
20
21
22
23
# File 'lib/sprockets/coffee_script_processor.rb', line 18

def self.call(input)
  data = input[:data]
  input[:cache].fetch([self.cache_key, data]) do
    Autoload::CoffeeScript.compile(data)
  end
end