class Sprockets::JstProcessor
‘application/javascript’, JstProcessor.new(namespace: ‘App.templates’)
‘application/javascript+function’,
environment.register_transformer
Change the default namespace.
‘application/javascript’, JstProcessor
’application/javascript+function’,
environment.register_transformer
To accept the default options
Name your template “users/show.ejs”, “users/new.eco”, etc.
Exports server side compiled templates to an object.
Public: JST transformer.
def self.call(input)
def self.call(input) instance.call(input) end
def self.default_namespace
def self.default_namespace 'this.JST' end
def self.instance
Public: Return singleton instance with default options.
def self.instance @instance ||= new end
def call(input)
def call(input) data = input[:data].gsub(/$(.)/m, "\\1 ").strip key = input[:name] <<-JST ction() { #{@namespace} || (#{@namespace} = {}); #{@namespace}[#{key.inspect}] = #{data}; all(this); JST end
def initialize(namespace: self.class.default_namespace)
def initialize(namespace: self.class.default_namespace) @namespace = namespace end