jimsynz / hamlbars

Some extensions to HAML to allow generation of Handlebars templates.
https://github.com/jamesotron/hamlbars.git
MIT License
179 stars 43 forks source link

Possible to have empty link-to helper? #63

Closed traviswsims closed 10 years ago

traviswsims commented 10 years ago

Hello all,

Is it possible to have an empty Handlebars link-to helper? Right now, I've got this:

=hb 'link-to "someResource.index" class="navbar-brand"' do
  \

Is there a better way to get an empty anchor tag without escaping the empty line? I'm doing this to add a CSS background image instead of text. Thanks so much.

jimsynz commented 10 years ago

not really, because the only way that Hamlbars knows you want to generate a handlebars block ({{#link-to}} ... {{/link-to}}) instead of expression ({{link-to ... }}) is that a block is passed. You could try something like:

=hb 'link-to "someResource.index" class="navbar-brand"' {}
traviswsims commented 10 years ago

Thanks for your quick response and explanation. I tried =hb 'link-to ...' {} and =hb 'link-to ...' do end, but got compilation errors.

This isn't a huge deal to me, I just wanted to make sure there wasn't some syntactic sugar I had missed. Thanks again.