Class: LiquidAssets::PipelineTemplateEngine

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/liquid_assets/pipeline_template_engine.rb

Defined Under Namespace

Classes: TemplatePath

Instance Method Summary collapse

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/liquid_assets/pipeline_template_engine.rb', line 9

def evaluate(scope, locals, &block)
    template_path = TemplatePath.new( scope )
    tmpl = Config.content_provider.call( template_path.name )
    source = if tmpl && tmpl.present?
                 tmpl.source
             else
                 data
             end
    "#{LiquidAssets::Config.namespace}.Templates[#{template_path.name.dump}] = #{ TinyLiquid.compile( source ) };"
end