leshill / handlebars_assets

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

Add chomp underscore flag for partials #124

Closed GreyKn closed 9 years ago

GreyKn commented 9 years ago

I have a couple of rails apps, some that use client side handlebars via handlebars_assets and some that use server side handlebars via handlebars-rails.

Unfortunately, using shared handlebar files between my apps do not work because of the way handlebars_assets and handlebars-rails each handle naming partials.

Both detect a partial by checking for a leading underscore. But handlebars-rails strips the underscore from the name when registering the partial. (see: https://github.com/cowboyd/handlebars-rails/blob/f73a2d11df8aa2c21d335b8f04a8c5b59ae6a790/lib/handlebars-rails/tilt.rb#L18).

This PR adds a config option (disabled by default) to strip the underscore from partials, so the partial register behavior is the same between both gems.

AlexRiedler commented 9 years ago

Looks good I'll add a test

GreyKn commented 9 years ago

Hi @AlexRiedler, thanks for reviewing. I went ahead and tried to write a test for the new behavior.

AlexRiedler commented 9 years ago

Merged!

AlexRiedler commented 9 years ago

@GreyKn Released.