ventojs / vento

🌬 A template engine for Deno & Node
https://vento.js.org/
MIT License
169 stars 9 forks source link

Request: {{ import }} in vento #9

Closed tjaynl closed 11 months ago

tjaynl commented 12 months ago

So i was wondering if there is a {{ import "file" as file }} option in Vento and if not would it be possible to request this feature for a future release?

oscarotero commented 12 months ago

What's the use case of this? It's possible to import javascript modules, but I assume you're talking about something different.

tjaynl commented 12 months ago

So i want to import some macro's that could be used in other files. For example i have a macro.njk which contains some macro's like:

{% macro even_columns(left, right, classes) %}
<section class="even-columns {{ classes }}">
    <img src="{{ left }}" alt="">
    <img src="{{ right }}" alt="">
</section>
{% endmacro %}

i want to import this file so i can use the macro in the content for example:

{{ even_columns("left.png", "right.png", "fullwidth" ) }}

oscarotero commented 12 months ago

Ok, understood. It's not possible right now, but it's a nice to have feature. I'll work on that.

oscarotero commented 11 months ago

Implemented in v0.7.0