问题
Is there a syntax example for using the "replace" handlebars helper? The doc is rather vague on the practical usage. Link to doc: here
For instance:
If I had a page name of "About Us" and I wanted to replace the space with a "-".
I have tried {{replace name " " "-"}} to no avail.
回答1:
We've revised the documentation on for handlebars.js helpers to include this example:
The following code would search for the string needle within the scope defined by haystack; if found, it would replace that string with the Handlebars block defined by :
{{#replace "needle" haystack}}
{{<context to use as a replacement>}}
{{/replace}}
来源:https://stackoverflow.com/questions/37487158/bigcommerce-stencil-custom-handlebars-replace-helper