Closed giuseppeg closed 3 years ago
A simplified alternative could be:
<meta name="title" slot:content="{title}">
<fill name="title">hello</fill>
<a slot:href="https://{subdomain}.{domain}">acme</a>
<fill name="domain">acme.com</fill>
<fill name="subdomain">real</fill>
xm is not a full blown templating system and will probably stay like this.
However I am thinking about implementing an extension (a separate PostHTML plugin) to add support for expressions and perhaps loops.
Please give this description a 👍 if you like this proposal or a 👎 if you'd rather use an existing PostHTML plugin like posthtml-expressions
The syntax would be
{xm:expression}
whereexpression
is a reference to afill
value or any other constant defined by the user via config file and is part of a serializedenv
object passed to the plugin as an option.Additionally
expression
can be an arrow function that takes one parameter - the fill value - and transforms that value:Finally I might add some built-in helpers to make things like url encoding easy: