Skip to content

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

Notifications You must be signed in to change notification settings

benkitzelman/sinatra-handlebars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages