Skip to content

Instantly share code, notes, and snippets.

@rodriguezartav
Created October 13, 2011 18:26
Show Gist options
  • Save rodriguezartav/1285037 to your computer and use it in GitHub Desktop.
Save rodriguezartav/1285037 to your computer and use it in GitHub Desktop.
config/initializers/stitch.rb it setups stitch to compile and include javascript applications templates in the main app file
class TmplCompiler < Stitch::Compiler
extensions :tmpl
def compile(path)
content = File.read(path)
%{var template = jQuery.template(#{content.to_json});
module.exports = (function(data){ return jQuery.tmpl(template, data); });}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment