Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration option for custom handlebar delimiters #398

Open
IrrerPolterer opened this issue Sep 15, 2023 · 3 comments
Open

Add configuration option for custom handlebar delimiters #398

IrrerPolterer opened this issue Sep 15, 2023 · 3 comments

Comments

@IrrerPolterer
Copy link

Currently plop relies entirely on the default handlebar implementation with {{ and }} delimiting handlebars in template files.
I want to create NextJs project generators. My nextjs template project however contains a lot of double-curly-brackets as part of the code.
For example: <TestComponent property={{key1: 123, key2:456}} />

When running plop on these files, it presents error messages, because handlebarsJs tries to interpret the double-curly-brackets as handlebars but doesn't understand their content.

To eliviate this problem I would like to simply adjust the delimiters of my handlebars to something like <% and %> for example.

@amwmedia
Copy link
Member

plop uses handlebars under the hood, so they would need to implement that feature first in order for us to support it. If this is already a feature of handlebars and it's somehow escaped my knowledge, please correct me. I'd love for plop to support this.

We've talked in the past about retooling plop to handle multiple templating languages, but it's been seen (so far) as not worth the effort.

There are ways of escaping double curlies for these use cases.

@IrrerPolterer
Copy link
Author

Thanks for the reply, this is certainly helpful! However, excaping curly brackets doesn't seem to work properly.

This works, as described in the handlebar docs:
\{{escaped}} renders {{escaped}}

But this does not work:

    {{{{raw}}}}
        {{escaped}}
    {{{{/raw}}}}

renders nothing.

@amwmedia
Copy link
Member

In the case of raw block helpers, you'd need to register the helper "raw" to make that work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants