Module: Octodmin::CjsxProcessor

Defined in:
app/config/sprockets.rb

Constant Summary collapse

VERSION =
'1'
SOURCE_VERSION =
::CoffeeScript::Source.version

Class Method Summary collapse

Class Method Details

.cache_keyObject



11
12
13
# File 'app/config/sprockets.rb', line 11

def self.cache_key
  @cache_key ||= [name, SOURCE_VERSION, VERSION].freeze
end

.call(input) ⇒ Object



15
16
17
18
19
20
# File 'app/config/sprockets.rb', line 15

def self.call(input)
  data = input[:data]
  input[:cache].fetch(self.cache_key + [data]) do
    ::CoffeeScript.compile(::CoffeeReact.transform(data))
  end
end