No commit activity in last 3 years
No release in over 3 years
Compiles and serves Handlebars template files (.hbs) as javascript from the configured Sinatra route, so they can be included as script from a given web page
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Sinatra Handlebars

Helpers for serving Handlebars.js templates in Sinatra.

  • Pre-compile handlebars templates from separate view files rather than littering them throughout your html.

Installation

gem install sinatra-handlebars

Setup

Install the plugin and add some options.

require 'sinatra/handlebars'

class App < Sinatra::Base
  register Sinatra::Handlebars
  handlebars {
    templates '/js/templates.js', ['app/templates/*']
  }
end

Partials

Partial template filenames must be prefixed with an '_', and are referenced without the prefix. For example, for the partial template file '_MyPartial.hbs', to render in a parent template it would be referenced as {{> MyPartial}}

Bitdeli Badge