Serving HAML assets outside of controllers

Hey guys,

I’ve got a rails app using Knockout.js and Path.js to do the UI, so all the HTML is built as separate HTML fragments that are dynamically downloaded by the browser and applied using JQuery templating. I LOVE haml and want to use it to write these templates, but I have no need for inline ruby or access to the controller and would prefer not to have to build routes just to serve them. Is there a way to use HAML outside of views, in the assets folder or the public folder that wouldn’t require me defining separate routes, but will still allow me to use it in development while deploying the generated HTML to production? I know this could be a question for the HAML group but I have a feeling it may have something to do with a configuration of the asset pipeline. I’m using 3.1 RC6.

Thanks in advance,

Jayme

Hey guys,

I’ve got a rails app using Knockout.js and Path.js to do the UI, so all the HTML is built as separate HTML fragments that are dynamically downloaded by the browser and applied using JQuery templating. I LOVE haml and want to use it to write these templates, but I have no need for inline ruby or access to the controller and would prefer not to have to build routes just to serve them. Is there a way to use HAML outside of views, in the assets folder or the public folder that wouldn’t require me defining separate routes, but will still allow me to use it in development while deploying the generated HTML to production? I know this could be a question for the HAML group but I have a feeling it may have something to do with a configuration of the asset pipeline. I’m using 3.1 RC6.

I believe haml install an haml executable which you can use to convert haml files to html.

You might want to check that out if that suits your needs :slight_smile:

Any advice on how to hook this into the asset pipeline so it executes whenever I update files?

Any advice on how to hook this into the asset pipeline so it executes whenever I update files?

Sorry I don’t get what you mean. From what I understand of your requirements, you want to

convert haml to html without rails doing it for you. if that’s the case, then i think you can use the

haml executable that comes with the gem. But I think you need to require files so that you can use

the rails helpers.