railsware/sht_rails — pull request #7 by dsrw (2013-05-28 10:02:29+00:00)
Title: Server side helper support

Support running javascript helpers on the server by running them through the asset pipeline, then evaling them in the handlebars context. Fixes #3.

This expects helpers to be at app/assets/javascripts/templates/helpers.js, but that's configurable. It uses the asset pipeline, so compile to JS languages (Coffeescript) will work fine.

Depending on your setup, templates/helpers.js may need to be added to config.assets.precompile in production.rb.

This change also caches the handlebars context between requests in environments where view caching is enabled (production). I didn't actually benchmark (shame on me), but it seems like it ought to provide some sort of performance boost.