Class: Stitch::TmplCompiler

Inherits:
Compiler show all
Defined in:
lib/stitch/compilers/tmpl.rb

Instance Method Summary collapse

Methods inherited from Compiler

all, all_extensions, compile, compilers, enabled, enabled?, extensions, for_extension, inherited, source, source?

Instance Method Details

#compile(path) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/stitch/compilers/tmpl.rb', line 5

def compile(path)
  content = File.read(path)
  %{var template   = jQuery.template(#{content.to_json});
    module.exports = function(data){
      return jQuery.tmpl(template, data);
    };}
end