Low commit activity in last 3 years
A long-lived project that still receives updates
The sprockets template for Ember Handlebars.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.7, < 3.0
>= 10.0, < 14.0

Runtime

>= 3.7, < 4.3
>= 0.11.0
 Project Readme

Ember::Handlebars::Template

The sprockets template for Ember Handlebars.

Installation

Add this line to your application's Gemfile:

gem 'ember-handlebars-template'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ember-handlebars-template

Usage

# Sprockets 2.x way
Sprockets.register_engine '.hbs', Ember::Handlebars::Template # or other extension which you like.

# Sprockets 3.x/4.x way
Sprockets.register_mime_type 'text/x-handlebars', extensions: ['.hbs'] # or other extension which you like.
Sprockets.register_transformer 'text/x-handlebars', 'application/javascript', Ember::Handlebars::Template

It can also compile "raw" templates – pure Handlebars templates, independent of Ember. They need to have a suffix .raw.hbs (the last extension depends on what was registered with register_engine).

Options

You can overwrite config like this:

Ember::Handlebars::Template.configure do |config|
  config.precompile = true

  # Or any of the options below.
end

precompile

Type: Boolean

Enables or disables precompilation.(default: true)

ember_template

Type: String

Default which Ember template type to compile. HTMLBars / Handlebars. (default: HTMLBars)

output_type

Type: Symbol

Configures the style of output. :global / :amd. (default :global)

amd_namespace

Type: String

Configures the module prefix for AMD formatted output. (default: nil)

raw_template_namespace

Type: String

Configures the namespace that the raw templates are assigned to. (default: JST)

templates_root

Type: String

Sets the root path for templates to be looked up in. (default: templates)

templates_path_separator

Type: String

The path separator to use for templates. (default: /)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release to create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request