Manual dynamic partial block

I have a folder structure like this:

- components/
  - foo/
     - index.js
     - foo.handlebars
     - foo.scss
  - bar/
     - index.js
     - bar.handlebars
     - bar.handlebars

      

To resolve partial parts of components efficiently, I provide a helper that will find the correct path translating bar

into components/bar/bar.handlebars

. This assistant is called getPartialForTemplate

.

In my template, I do:

{{> (getPartialForTemplate 'foo') some=props}}

This is fine, but when I need to use an allowed pattern as a block, I run into a problem:

{{#> (getPartialForTemplate 'foo')}}
  <p>Some text here..</p>
{{/WHATGOESHERE???}}

      

This is similar to the lack of syntax in Handlebars, as I expect its syntax functions to work together. Is there a way to do this?

+3


source to share





All Articles