Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@cowboyd
Created October 29, 2014 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowboyd/e4f2ae72ee986358a6ff to your computer and use it in GitHub Desktop.
Save cowboyd/e4f2ae72ee986358a6ff to your computer and use it in GitHub Desktop.
Using Precompiled Templates from Ruby
require 'handlebars'
# reopen this class to give access to the
# underlying runtime
class Handlebars::Context
attr_reader :js
end
context = Handlebars::Context.new
template = context.js.eval my_precompiled_template
template.call foo: 'bar'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment