Closed obiwan00 closed 6 months ago
Hi, thanks for the report. Where is the ignored expression placed - in a layout, a template, or a component file?
I have just checked. The issue occurs in layout, template, and components.
There might be double-compilation happening, does @@{{ test }}
work instead?
Using @@{{ test }}
doesn't fix the issue properly
module.exports = {
build: {
fail: 'verbose',
templates: {
source: [
'src/templates', // ❌still not working, it will require using `@@@{{ test }}` to start working
'src/templates2', // ✅ works with `@@{{ test }}`
'src/templates3', // ❌ `@@{{ test }}` leads to output: `@{{ test }}`
],
OK, thanks for confirming. Will look into it, not yet sure what can be done about it.
Thank you.
If this can't be resolved, I may use another syntax for Maizzle interpolation, like [[ ... ]]
. Then using {{ ... }}
won't cause the issue. https://maizzle.com/docs/expressions#change-delimiters
Checked in v5 which is under development and looks to be working as expected.
In v5 template sources will use globs, just like the Tailwind config:
Great. Do you have an approximate release date for v5?
Not yet... Trying to have it ready by the end of March when Maizzle turns 5 years old, but there's so much to cover (esm, types, docs, tests...) that realistically speaking I'll only have a beta ready by then.
Ok, thank you. Good luck.
Check v4.8.1
, you might not need to ignore expressions that contain undefined vars :)
Something like this will be output as-is, as long as unsub
is not defined:
<a href="{{ unsub }}">Unsubscribe</a> from my emails.
Done with the missingLocal
config, it's not set to {local}
by default.
Docs: https://maizzle.com/docs/configuration/expressions#missinglocal
Thank you for the updates.
I found out that if I use the build.templates
array with only one source
in each template
config, this issue with @{{...}}
does not reproduce.
Had to revert this in v4.8.2
as it was causing issues with existing components, mainly because &&
(logical AND) doesn't work as expected in node:vm
, so this was creating broken code.
But you can enable it manually, i.e.:
module.exports = {
build: {
posthtml: {
options: {
missingLocal: '{local}'
}
}
}
}
And then make sure to use simple ternaries instead of logical AND everywhere; for example replace stuff like this that we have in the Divider or Spacer components:
- {{ spaceY && `margin-top: ${spaceY}; margin-bottom: ${spaceY}` }};
+ {{ spaceY ? `margin-top: ${spaceY}; margin-bottom: ${spaceY}` : '' }};
We'll bring it back in Maizzle 5 when we'll update the Starter components too 👍
Ok, thank you. Have a nice day)
Expression Ignoring syntax
@{{...}}
doesn't properly work with configbuild.templates.source
is an array.HTML file content for testing:
Expected result:
Actual result:
config.js:
Thank you for your work.