PostHTML Expression Delimiter Option Only Applies to Templates, not Layouts
See original GitHub issue- Maizzle Version: Framework v3.7.3, CLI v1.4.0
- Node.js Version: 16.5.0
I’m trying to use Maizzle to output templates for an existing Java/Pebble system, similar to https://github.com/maizzle/framework/issues/346.
I wish to change my PostHTML Expressions delimiters in Pebble from {{
to [[
as documented on the Maizzle website: https://maizzle.com/docs/templates/#options
This is not currently working consistently between layout and template files, however.
This is my layout:
<div class="border-0 border-solid border-t-2 mt-24 border-brandColor border-b-2">
<p>Layout square brackets: [[ page.language ]]</p>
<p>Layout curly braces: {{ page.language }}</p>
<block name="template"></block>
</div>
This is my template:
<extends src="src/layouts/main.html">
<block name="template">
<p>Template square brackets: [[ page.language ]]</p>
<p>Template curly braces: {{ page.language }}</p>
</block>
</extends>
This is my config:
module.exports = {
build: {
templates: {
source: 'src/templates',
destination: {
path: 'build_local',
},
assets: {
source: 'src/images',
destination: 'images',
},
},
posthtml: {
expressions: {
delimiters: ['[[', ']]'],
unescapeDelimiters: ['[[[', ']]]'],
}
},
},
}
And this is the rendered result:
Ideally, I would like to be able to use {{ }}
freely in Front Matter variables and template HTML with no issues. It’s important to me as well that other templating directives that our existing system uses (e.g. it has loops such as {% for i in x %} {{ i }} {% endfor %}
can also be put into Maizzle with minimal friction for our existing developers. 😃
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top GitHub Comments
Indeed, that solved my problem. I was not aware of this option. Thank you! 🙏
You’ll need to customize it for the components as well: