made by itsOik
-
It sucks!
-
its only by luck that it works!
-
Replace tags in HTML by using EXACTLY this syntax:
-
for CSS:
(requires opening and closing<style>
tags)
<style>{% style <nameOfFile>.css %}</style>
-
for scripts(js):
(requires opening and closing<script>
tags)
<script>{% script <nameOfFile>.js %}</script>
-
INCLUDES
tag:
{% INCLUDES <nameOfFile>.html %}
-
EXTENDS
tag
(supports BLOCK (must have matching block in file it extends))
{% EXTENDS <nameOfFile>.html %}
{% BLOCK <nameOfBlock> %} {% ENDBLOCK <nameOfBlock> %}
-
FOR
loops:
(must be nested in block if extends) to pass data to use in for loops use following syntax:in app.js:
const data = {data: ["value1", ...]} // must be key/array pairs templateEngine.render(templateName.html, data) // call with "data" as 2nd variable in the function call
in template HTML:
{% FOR dataVar of data %} <br> // do something with `{{ dataVar }}` <br> {% ENDFOR %}
-
{{ tag }}
(single-tag) replacement:
Replaces tag with data from a "key,value" object with same "key" as the{{ tag }}
-
20/12-21:
- passing variables
- for loop templating
- single tag replacing
19/12-21:
- EXTENDS tag
- BLOCK tag
- INCLUDES tag
- style tag
- script tag
- NodeJS: v16+
- Coming soon™