{"id":18694,"library":"pug-cli","title":"Pug CLI","description":"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.","status":"active","version":"1.0.0-alpha6","language":"javascript","source_language":"en","source_url":"https://github.com/pugjs/pug-cli","tags":["javascript"],"install":[{"cmd":"npm install pug-cli","lang":"bash","label":"npm"},{"cmd":"yarn add pug-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add pug-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core template engine required for compilation","package":"pug","optional":false},{"reason":"Command-line argument parsing","package":"commander","optional":false},{"reason":"Directory creation for output","package":"mkdirp","optional":false}],"imports":[{"note":"CLI tool, not a module. Use npx pug or install globally.","wrong":"pug -c file.pug (without --client, outputs HTML)","symbol":"pug command","correct":"pug file.pug"},{"note":"pug-cli is a CLI, not a module. Use require('pug') for API.","wrong":"require('pug-cli')","symbol":"require('pug')","correct":"require('pug')"},{"note":"Import pug module, not pug-cli.","wrong":"pug.compile() directly (missing require)","symbol":"pug.compile()","correct":"const pug = require('pug'); pug.compile('...')"}],"quickstart":{"code":"npm install -g pug-cli\n# Create a Pug template\necho 'h1 Hello #{name}' > template.pug\n# Compile with variable\necho '{\"name\": \"World\"}' | pug -O /dev/stdin template.pug\ncat template.html","lang":"javascript","description":"Install pug-cli globally, create a .pug file, compile with JSON options from stdin, output HTML."},"warnings":[{"fix":"Use --client only for client-side compilation, and include pug-runtime in your project.","message":"When using --client, the output is a JavaScript function, not HTML. You need to include the Pug runtime.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use --name explicitly instead.","message":"The --name-after-file option may be removed in future versions.","severity":"deprecated","affected_versions":">=1.0.0-alpha6"},{"fix":"Ensure output directory exists before running, or use mkdirp.","message":"Output directory is not created automatically if it doesn't exist; pug-cli will error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use double quotes for JSON: pug -O '{\"key\": \"value\"}' file.pug","message":"The -O option with JSON string must be a valid JSON object, not a JavaScript object literal with single quotes.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure all template files have .pug extension.","message":"When using watch mode, only changes to files with .pug extension trigger re-render. Other file changes are ignored.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':14 'allow':16 'alpha':61 'alpha6':15 'altern':65 'build':43 'cli':2,58 'client':24 'client-sid':23 'command':4 'command-lin':3 'compil':17 'custom':32 'directori':34 'engin':12 'file':19,39 'former':9 'generat':48 'gulp':68 'gulp-pug':67 'html':21 'includ':66 'infrequ':63 'integr':74 'interfac':6 'jade':10 'javascript':26,76 'json/js':38 'line':5 'loader':72 'maintain':49 'option':36 'output':33 'part':51 'pretti':30 'pretty-print':29 'primarili':40 'print':31 'project':55 'pug':1,8,18,54,69 'releas':64 'side':25 'site':47 'static':46 'support':27 'templat':11 'though':56 'tool':44 'use':41 'version':13 'via':37 'watch':28 'webpack':71 'workflow':75","created_at":"2026-04-25T07:39:38.352682+00:00","updated_at":"2026-04-25T07:39:38.352682+00:00","problems":[{"fix":"npm install -g pug-cli","cause":"pug-cli is not installed globally","error":"pug: command not found"},{"fix":"npm install pug","cause":"pug package is not installed locally or globally","error":"Cannot find module 'pug'"},{"fix":"Create output directory: mkdir -p <outdir>","cause":"Output directory does not exist","error":"ENOENT: no such file or directory"},{"fix":"Use valid JSON with double quotes: pug -O '{\"key\": \"value\"}' file.pug","cause":"Invalid JSON string passed to -O","error":"SyntaxError: Unexpected token } in JSON"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"pug","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/pugjs/pug-cli","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/pug-cli","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}