monta-cli
TypeScript icon, indicating that this package has built-in type declarations

0.5.5 • Public • Published

Monta CLI

Command-line tool to compile Monta templates into HTML files.

npm license Build Status Codecov David

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

Package Sidebar

Install

npm i monta-cli

Weekly Downloads

1

Version

0.5.5

License

ISC

Unpacked Size

15.7 kB

Total Files

15

Last publish

Collaborators

  • woubuc