monta-cli
v0.5.5
Published
Monta CLI utility
Downloads
6
Maintainers
Readme
Monta CLI
Command-line tool to compile Monta templates into HTML files.
Usage
npm install --global monta-cli
monta templates/**/*
This will compile all template files (*.mt
or *.html
) in the
templates/
directory and subdirectories, and place the rendered html
files in the default output directory dist/
The CLI will skip over any files starting with an underscore (e.g.
_base.mt
). You can use this to avoid compiling base templates that
your other pages extend from.
Note: Monta CLI uses fast-glob 3, which expects forward slashes /
on all operating systems, including Windows. Backslashes \
are used
for escaping characters. See the fast-glob pattern syntax
for more information.
Template Data
You can pipe a JSON object into Monta CLI, and it will be used as the template data in your templates.
<p>${ foo }</p>
echo {"foo":"bar"} | monta templates/foo.mt
Will result in:
<p>bar</p>
Root
Set the template root directory by providing the --root
argument.
If omitted, Monta CLI will use the current working directory to
resolve file paths.
monta views/**/*.mt --root ./views
Output Directory
You can define a different output directory by providing the --out
argument.
monta templates/**/* --out ./my-out-dir
Extensions
By default, the CLI looks for .mt
and .html
files. If you want to
use a different file extension, you can specify it with the --ext
argument.
monta templates/**/* --ext .myext
monta templates/**/* --ext .mt,.html,.myext