Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template engine not found: handlebars #3

Closed
mtrovo opened this issue Oct 3, 2014 · 3 comments
Closed

Template engine not found: handlebars #3

mtrovo opened this issue Oct 3, 2014 · 3 comments
Assignees

Comments

@mtrovo
Copy link

mtrovo commented Oct 3, 2014

I'm trying to run the provided example and it seems to be broken.

require 'sinatra'
require 'sinatra/handlebars'

class MyApp < Sinatra::Base
  helpers Sinatra::Handlebars

  get "/hello" do
    handlebars :index, locals: {name: 'Joe'}
  end

  run! if app_file == $0
end

Gives me

RuntimeError - Template engine not found: handlebars:
    /home/mtrovo/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:834:in `block in compile_template'
    /home/mtrovo/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/tilt-1.4.1/lib/tilt.rb:127:in `fetch'
    /home/mtrovo/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:832:in `compile_template'
    /home/mtrovo/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:813:in `render'
    /home/mtrovo/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/tilt-handlebars-1.3.1/lib/sinatra/handlebars.rb:4:in `handlebars'
    hbs.rb:8:in `block in <class:MyApp>'

My gems versions are:

  • buftok (0.2.0)
  • bundler (1.3.5)
  • chronic_duration (0.10.6)
  • colorize (0.7.3)
  • diff-lcs (1.2.5)
  • em-twitter (0.3.3)
  • eventmachine (1.0.3)
  • handlebars (0.6.0)
  • handlebars-source (1.3.0)
  • http_parser.rb (0.6.0)
  • libv8 (3.16.14.7)
  • mockingbird (0.2.0)
  • numerizer (0.1.1)
  • rack (1.5.2)
  • rack-protection (1.5.3)
  • ref (1.0.5)
  • rspec (3.1.0)
  • rspec-core (3.1.5)
  • rspec-expectations (3.1.2)
  • rspec-mocks (3.1.2)
  • rspec-support (3.1.1)
  • simple_oauth (0.2.0)
  • sinatra (1.4.5)
  • therubyracer (0.12.1)
  • tilt (1.4.1)
  • tilt-handlebars (1.3.1)
@commonsguy
Copy link

You need to also require tilt/handlebars to make sinatra/handlebars work.

@jimothyGator jimothyGator self-assigned this Dec 12, 2014
@jimothyGator
Copy link
Collaborator

@commonsguy : Thanks. I've fixed this in the develop branch so you don't need to require tilt/handlebars explicitly. I plan to release a new Gem once I've fixed #5 (memory leak).

But in the meantime, @mtrovo you may use @commonsguy's suggestion and just add the following to the top of your app:

require 'tilt/handlebars'

@jimothyGator
Copy link
Collaborator

Fixed in version 1.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants