Skip to content

About

Compress handlebars.js templates and partials into a single served js asset

Resources

Stars

9 stars

Watchers

1 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

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

About

Compress handlebars.js templates and partials into a single served js asset

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages