netzpirat/haml_coffee_assets — pull request #79 by jimmycuadra (2013-01-09 19:04:44+00:00)
Title: Add ActionView::Template handler for hamlc files.

I'm working on a new feature to allow usage of the same haml-coffee template files for both Rails templates and JavaScript templates. I wanted to get some feedback on how to approach this. The current implementation isn't particularly pretty looking, but it enables the basic functionality.

The Rails engine now adds `app/templates` to the Rails view path and the Sprockets load path so that shared templates can be placed there.

The main thing I'm wondering how best to accomplish is giving access to the HAML object provided by `vendor/assets/javascripts/hamlcoffee.js.coffee.erb` when rendering on the server. Right now I'm just providing a shim object so the templates will render, but I'd like to have the real object as it would exist on the client available to the template on the server.

Other things to consider or that I'd like to add:

* Using `app/templates` as the view/Sprockets path should be configurable.
* How will the `foo.hamlc` vs. `foo.jst.hamlc` distinction affect things when the same templates are being rendered by ActionView?
* Should server-side templates be optional entirely? If so, should it be enabled or disabled by default?