leshill / handlebars_assets

Use handlebars.js templates with the Rails asset pipeline.
MIT License
649 stars 159 forks source link

Prefix or path for partials? #113

Open andreasheim opened 9 years ago

andreasheim commented 9 years ago

Is there a way to provide a common prefix for partials so that they can be used without a folder name?

E.g. partialsPath = 'templates/partials' or partialsDefaultPath

And then the partials can be used like

{{> partial-file-name}}

instead of

{{> partials/_partial-file-name}}

Obviously I could just put global partials in the templates folder, but that feels dirty.

(strip the underscore as well, but I could live with still needing it).

Apologies if I missed something obvious.

AlexRiedler commented 9 years ago

@andreasheim you could do this in your own personal javascript; I am now wondering what I could support for this case though as well...

Getting proper name stripping is actually a pretty hard thing to do, might need to add another configuration option for something like this.

andreasheim commented 9 years ago

I don't know how other tools implement it. I think they may rather just have you specify different folders for normal templates and partials. Not sure how that would integrate with the sprockets asset pipeline though.