Class: Stitch::MustacheCompiler

Inherits:
Compiler
  • Object
show all
Defined in:
lib/stitch/compilers/mustache.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/mustache.rb', line 5

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