Project

sc-rails

0.0
No commit activity in last 3 years
No release in over 3 years
This gem adds handlebars.js compilation to the Rails 3.1 asset pipeline and provides packaged builds of SproutCore 2.0
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

~> 3.1.0
 Project Readme

sc-rails

This gem adds handlebars.js compilation to the Rails 3.1 asset pipeline and provides packaged builds of SproutCore 2.0

Installation

Add it to your Gemfile:

gem "sc-rails"

Update your bundle:

$ bundle install

Usage

Place handlebars templates in their own files with the .hjs extension:

<!-- app/assets/javascripts/templates/author.hjs -->
<div class="author">{{name}}</div>

In your manifest file, require the plugin followed by your individual templates. The templates are compiled and named with their Sprockets logical path:

//= require sproutcore
//= require templates/author

Complied templates end up in SC.TEMPLATES where SproutCore can find them.

Acknowledgements

This gem is a blatant copy of the .tmpl Sprockets engine by Jimmy Cuadra which in turn is based on the sprockets-jquery-tmpl gem.

Why did you bother creating another Handlebars/SproutCore Rails gem?

I didn't want to create this gem at all. However, I couldn't get the sproutcore-rails gem to work and for some reason that continues to elude me, simply putting the template class and engine registration in a initializer doesn't work either. I would much prefer that approach. If you understand how to do that, tell me and I will deprecate this project and replace it with a Gist.