aymerick / raymond

Handlebars for golang
MIT License
610 stars 101 forks source link

Partial Block support #21

Open jgthms opened 7 years ago

jgthms commented 7 years ago

Hello @aymerick and thanks for your library.

It seems raymond doesn't support partial blocks?

Where you would have 2 files: main.hbs and mypartial.hbs

1. Main Container
{{#> mypartial }}
  2. Hello World
{{/mypartial}}
3. Foo Bar
{{> @partial-block }}

And the output would be:

1. Main Container
3. Foo Bar
2. Hello World

Am I missing something? 🤔

jgthms commented 7 years ago

Found a workaround:

main.hbs

1. Main Container
{{> mypartial
  subpartial="other-partial.hbs"
}}

mypartial.hbs

3. Foo Bar
{{> (subpartial) }}

other-partial.hbs

2. Hello World

The output is:

1. Main Container
3. Foo Bar
2. Hello World

Note the dynamic partial (subpartial).