{"id":18677,"library":"posthtml-cli","title":"PostHTML CLI","description":"Command-line interface for PostHTML, a tool for transforming HTML/XML with plugins. Current stable version is 0.10.0, with releases roughly every few months. It supports processing multiple files, glob patterns, custom config files (JSON/JS), and built-in notifications for updates. Compared to alternatives like html-postcss or custom scripts, posthtml-cli provides a simple CLI with plugin loading and file watching. Requires Node >=10. Currently in maintenance mode with no major recent activity.","status":"maintenance","version":"0.10.0","language":"javascript","source_language":"en","source_url":"https://github.com/posthtml/posthtml-cli","tags":["javascript","posthtml","posthtml-runner","cli"],"install":[{"cmd":"npm install posthtml-cli","lang":"bash","label":"npm"},{"cmd":"yarn add posthtml-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add posthtml-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"core library for HTML transformations","package":"posthtml","optional":false},{"reason":"loads plugin configuration from .posthtmlrc or similar","package":"posthtml-load-config","optional":true},{"reason":"notifies users of available updates","package":"update-notifier","optional":true}],"imports":[{"note":"The binary is called 'posthtml-cli' to avoid confusion with the posthtml package. Use npx or global install.","wrong":"posthtml --help","symbol":"posthtml-cli (binary)","correct":"npx posthtml-cli --help"},{"note":"No programmatic API, only CLI usage.","wrong":"posthtml [options] <files>","symbol":"not applicable (CLI only)","correct":"posthtml-cli [options] <files>"}],"quickstart":{"code":"npm install -g posthtml-cli\n# Process a single file\necho '<div class=\"hello\">Hi</div>' > input.html\nposthtml-cli -i input.html -o output.html\n# Process multiple files with a glob\nposthtml-cli 'src/**/*.html' -d dist\n# Use a config file (.posthtmlrc.js)\necho 'module.exports = { plugins: { \"posthtml-include\": {} } }' > .posthtmlrc.js\nposthtml-cli -i src/index.html -o dist/index.html","lang":"javascript","description":"Install globally, process HTML files with plugins defined in config."},"warnings":[{"fix":"If using a config function that returns a promise, ensure compatibility; previously only synchronous was supported.","message":"v0.9.0: Changed behavior of config loading - now supports async config files","severity":"breaking","affected_versions":">=0.9.0"},{"fix":"Use --all-in-out instead of --all-in-output.","message":"v0.8.0: Option --all-in-output replaced with --all-in-out","severity":"deprecated","affected_versions":">=0.8.0"},{"fix":"Use forward slashes or double backslashes in glob patterns on Windows.","message":"Glob patterns on Windows may need escaped or use forward slashes","severity":"gotcha","affected_versions":">=0.7.6"},{"fix":"Check documentation for plugin order precedence (CLI overrides config?).","message":"Plugin ordering: CLI and config files may combine in unexpected order","severity":"gotcha","affected_versions":">=0.7.4"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install -g posthtml-cli or use npx posthtml-cli.","cause":"posthtml-cli not installed globally or in PATH","error":"posthtml-cli: command not found"},{"fix":"Check the pattern: use 'src/**/*.html' for all HTML files in src/","cause":"Glob pattern didn't match any files (e.g., missing file extension or wrong path)","error":"Error: No files matched the given pattern"},{"fix":"Install posthtml-load-config: npm install posthtml-load-config --save-dev","cause":"Missing peer dependency posthtml-load-config when using a config file","error":"Error: Cannot find module 'posthtml-load-config'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}