posthtml-expressions
posthtml-expressions copied to clipboard
Use variables, JS-like expressions, and even markup-powered logic in your HTML.
Suppose we have a variable for set body class. In case we don't pass any variable as body class I get `class="undefined"` How to check if variable is set? Like:...
Sorry beginner coder here, this has been driving me nuts though. Is it possible to pass arrays directly in the tags locals attribute? I don't see any examples on how...
In read me there is this example: ```html {{ item }} ``` But it seem not working.. Only when passing array via locals. Also adding below not working: ```html module.exports...
i used `[ '[[', ']]' ]` but it didn't work. Just write it in `config.js`. Is there some reason ? _Originally posted by @cy-98 in https://github.com/posthtml/posthtml-expressions/issues/9#issuecomment-745179228_
Hi, I'm using posthtml-expressions as a part of [maizzle](https://maizzle.com) to generate templates. I used the following settings to change my delimiters: ``` expressions: { delimiters: ['[[', ']]'], unescapeDelimiters: ['[[[', ']]]'],...
Documentation states one way to define data — via plugin invocation. But often it may be necessary to define data directly in HTML for specific expressions (like data for included...
```html {{ item[1] }} ``` use template ```js import template from 'foo.html'; document.querySelector('#ex').innerHTML = template({ List: [['/', 'Home'], ['/about', 'About'], ['/contact', 'Contact']] }); ``` ```html {{ item[1] }} ``` Output:...
Imagine we already had a `page.title` variable in context, and we could access it through `{{ page.title }}`. Would be cool if we could define a variable in the context...
Would be awesome if `posthtml-expressions` offered support for filters, [like Nunjucks does](https://mozilla.github.io/nunjucks/templating.html#builtin-filters). So you could do stuff like: ```js locals: { greeting: 'hello there' } ``` ```html {{ greeting |...