Installing nhp makes the nhp executable available to npm scripts and package-manager command shims.
nhp <input.nhp> [output.html]input.nhp is the template to compile. If output.html is omitted, NHP writes an HTML file next to the input using the same basename.
nhp views/index.nhp
# writes views/index.html
nhp views/index.nhp public/index.html
# writes public/index.htmlThe command creates missing parent directories for the output path. It prints the resolved output path on success and exits with status 1 after writing an error to stderr on failure.
For a project dependency, npm automatically exposes the binary in scripts:
{
"scripts": {
"build:html": "nhp src/pages/home.nhp dist/home.html"
}
}Run it with:
npm run build:htmlThe CLI compiles with an empty render context. Use it for templates that contain static content, set values, includes, and other self-contained directives. Values that rely on application locals are undefined unless the template provides a fallback expression.
For dynamic templates, use the Node.js API to supply render locals. See Getting started.