Registry / devops / pug-cli

pug-cli

JSON →
library1.0.0-alpha6jsnpmunverified

Command-line interface for Pug (formerly Jade) template engine, version 1.0.0-alpha6. Allows compiling .pug files to HTML or client-side JavaScript. Supports watching, pretty-printing, custom output directories, and options via JSON/JS files. Primarily used for build tooling and static site generation. Maintained as part of the Pug project, though the CLI is in alpha with infrequent releases. Alternatives include gulp-pug or webpack loaders for integrated workflows.

npm install pug-cli
INSTALL
IMPORT
SIG · PUG-CLI
P
pug-cli
devopsjavascriptv1.0.0-alpha6
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pug command
pug file.pug
pug -c file.pug (without --client, outputs HTML)
CLI tool, not a module. Use npx pug or install globally.
require('pug')
require('pug')
require('pug-cli')
pug-cli is a CLI, not a module. Use require('pug') for API.
pug.compile()
const pug = require('pug'); pug.compile('...')
pug.compile() directly (missing require)
Import pug module, not pug-cli.

Install pug-cli globally, create a .pug file, compile with JSON options from stdin, output HTML.

npm install -g pug-cli # Create a Pug template echo 'h1 Hello #{name}' > template.pug # Compile with variable echo '{"name": "World"}' | pug -O /dev/stdin template.pug cat template.html
pug --version
Debug
Known issues
gotchaWhen using --client, the output is a JavaScript function, not HTML. You need to include the Pug runtime.
fix
Use --client only for client-side compilation, and include pug-runtime in your project.
affects: >=1.0.0
deprecatedThe --name-after-file option may be removed in future versions.
fix
Use --name explicitly instead.
affects: >=1.0.0-alpha6
gotchaOutput directory is not created automatically if it doesn't exist; pug-cli will error.
fix
Ensure output directory exists before running, or use mkdirp.
affects: >=1.0.0
gotchaThe -O option with JSON string must be a valid JSON object, not a JavaScript object literal with single quotes.
fix
Use double quotes for JSON: pug -O '{"key": "value"}' file.pug
affects: >=1.0.0
gotchaWhen using watch mode, only changes to files with .pug extension trigger re-render. Other file changes are ignored.
fix
Ensure all template files have .pug extension.
affects: >=1.0.0
Errors
Common errors & fixes
pug: command not found
pug-cli is not installed globally
fix
npm install -g pug-cli
Cannot find module 'pug'
pug package is not installed locally or globally
fix
npm install pug
ENOENT: no such file or directory
Output directory does not exist
fix
Create output directory: mkdir -p <outdir>
SyntaxError: Unexpected token } in JSON
Invalid JSON string passed to -O
fix
Use valid JSON with double quotes: pug -O '{"key": "value"}' file.pug
Upgrade
Version history
1.0.0-alpha6latest on npm
Audit
Dependencies
pugrequiredCore template engine required for compilation
commanderrequiredCommand-line argument parsing
mkdirprequiredDirectory creation for output
Agent activity
6 hits · last 30 days
node
6
Resources
pug-cli — npm install pug-cli · libregistry