Super Type Markup Language
Lightweight JavaScript template engine for better cleaner code.
Install
$ npm install stml# Or$ yarn add stml
Usage
const src = fsconst dest = stmlconsole
API
Name | Type | Default | Description |
---|---|---|---|
locals | Object | The options to pass params to template. | |
filename | String | The absolute path souce filename when extends is declared. | |
expressionOpen | String | '{' | Expression statement open syntax. |
expressionClose | String | '}' | Expression statement close syntax. |
blockOpen | String | '<%' | Block statement open syntax. |
blockClose | String | '%>' | Block statement close syntax. |
Syntax
expression statement
Use jsx syntax for expression statement.
{ name } <!-- escape -->{- name } <!-- unescape -->
block statement
Use jsp syntax for block statement.
<% if (entries.length) { %><% entries.forEach(function(entry){ %>{ entry }<% }) %><% } %>
extends statement
Use jsp syntax for extends statement.
<% extends 'header.html' %>
License
Released under the MIT license.