class Sprockets::CoffeeJsx

Preprocessor that runs CJSX source files through coffee-jsx-transform

Constants

CJSX_EXTENSION
CJSX_PRAGMA

Public Class Methods

call(input) click to toggle source
# File lib/sprockets/coffee-jsx.rb, line 19
def self.call(input)
  filename  = input[:source_path] || input[:filename]
  source    = input[:data]
  run(filename, source)
end
install(environment = ::Sprockets) click to toggle source
# File lib/sprockets/coffee-jsx.rb, line 33
def self.install(environment = ::Sprockets)
  Sprockets::CoffeeJsx::Engine.install(environment)
end
run(filename, source) click to toggle source
# File lib/sprockets/coffee-jsx.rb, line 25
def self.run(filename, source)
  if filename =~ CJSX_EXTENSION || source =~ CJSX_PRAGMA
    ::CoffeeReact.transform(source)
  else
    source
  end
end

Public Instance Methods

evaluate(scope, locals, &block) click to toggle source
# File lib/sprockets/coffee-jsx.rb, line 15
def evaluate(scope, locals, &block)
  self.class.run(scope.pathname.to_s, data)
end
prepare() click to toggle source
# File lib/sprockets/coffee-jsx.rb, line 12
def prepare
end