{"id":24983705,"url":"https://github.com/posthtml/posthtml-cli","last_synced_at":"2025-07-11T19:33:55.960Z","repository":{"id":49655866,"uuid":"49882940","full_name":"posthtml/posthtml-cli","owner":"posthtml","description":"CLI for PostHTML","archived":false,"fork":false,"pushed_at":"2021-11-11T06:28:48.000Z","size":3946,"stargazers_count":28,"open_issues_count":11,"forks_count":18,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-11T20:52:17.700Z","etag":null,"topics":["cli","posthtml","posthtml-runner"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/posthtml.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":".github/funding.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":"posthtml","open_collective":"posthtml","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2016-01-18T14:43:12.000Z","updated_at":"2024-11-10T02:43:06.000Z","dependencies_parsed_at":"2022-09-10T11:41:51.380Z","dependency_job_id":null,"html_url":"https://github.com/posthtml/posthtml-cli","commit_stats":null,"previous_names":[],"tags_count":77,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480515,"owners_count":21110936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","posthtml","posthtml-runner"],"created_at":"2025-02-04T09:20:33.546Z","updated_at":"2025-04-11T20:52:22.329Z","avatar_url":"https://github.com/posthtml.png","language":"JavaScript","readme":"# posthtml-cli\n\n\u003e [PostHTML][posthtml-url] сommand line interface\n\n[![Actions Status](https://github.com/posthtml/posthtml-cli/workflows/Actions%20Status/badge.svg?style=flat-square)](https://github.com/posthtml/posthtml-cli/actions?query=workflow%3A%22CI+tests%22)[![node][node-image]][node-url][![NPM version][npm-image]][npm-url][![XO code style][style]][style-url][![Coveralls Status][coveralls-image]][coveralls-url]\n\n[![npm downloads][npm-download-image]][npm-download-url][![npm][npm-total-download-image]][npm-total-download-url]\n\n## Install\n\n```bash\n$ npm install --global posthtml-cli\n```\n\n\u003e Note: This project is compatible with node v10+\n\n## Usage\n\n```bash\n$ posthtml --help\n\n  Usage:\n    $ posthtml \u003cpatterns\u003e\n\n  Options:\n    --output -o      Output File or Folder\n    --config -c      Path to config file\n    --use -u         PostHTML plugin name\n    --root -r        Mirror the directory structure relative to this path in the output directory(default: .)\n    --allInOutput -a Save the nesting structure for output\n    --skip -s        Skip parsing file\n    --help -h        CLI Help\n    --version -v     CLI Version\n\n  Examples:\n    $ posthtml input.html\n    $ posthtml input.html -o output.html\n    $ posthtml inputFolder/*.html !unicorn.html\n    $ posthtml '**/*.html' '\\!**/unicorn.html'\n    $ posthtml '**/*.html' -s unicorn.html\n    $ posthtml input-one.html input-two.html -o outputFolder\n    $ posthtml input.html -o output.html -c posthtml.js\n    $ posthtml input.html -o output.html -u posthtml-bem --posthtml-bem.elemPrefix __\n    $ posthtml inputFolder/*.html -o outputFolder\n    $ posthtml inputFolder/**/*.html -o outputFolder -a\n    $ posthtml '**/*.html' -o outputFolder -a -r inputFolder\n```\n\u003e ⚠️ Please note that when using patterns on the command line `*` and `!` escaping of characters is necessary. When using as **npm** scripts, you only need to screen the pattern `*`. [About the reasons](https://github.com/posthtml/posthtml-cli/issues/317#issuecomment-676330082)\n\n## Options\n\n```json\n{\n  \"root\": \"src\",\n  \"input\": \"*.html\",\n  \"output\": \"dist\",\n  \"skip\": [\"skip.html\", \"file.html\"],\n  \"options\": {\n    \"sync\": true,\n    \"directives\": [{\"name\": \"?php\", \"start\": \"\u003c\", \"end\": \"\u003e\"}]\n  },\n  \"plugins\": {\n    \"posthtml-plugin-name\": {\n      \"property\": \"value\"\n    }\n  }\n}\n```\n\n\u003e example config _`.posthtmlrc`_\n\n[posthtml-url]: http://github.com/posthtml/posthtml\n[npm-total-download-url]: https://www.npmjs.com/package/posthtml-cli\n[npm-total-download-image]: https://img.shields.io/npm/dt/posthtml-cli.svg?style=flat-square\n[npm-download-url]: https://www.npmjs.com/package/posthtml-cli\n[npm-download-image]: https://img.shields.io/npm/dm/posthtml-cli.svg?style=flat-square\n[node-url]: \"\"\n[node-image]: https://img.shields.io/node/v/posthtml-cli.svg?maxAge=2592000\u0026style=flat-square\n[npm-url]: https://npmjs.org/package/posthtml-cli\n[npm-image]: http://img.shields.io/npm/v/posthtml-cli.svg?style=flat-square\n[testen-url]: https://github.com/egoist/testen\n[testen-image]: https://img.shields.io/badge/testen-passing-brightgreen.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/posthtml/posthtml-cli\n[coveralls-image]: http://img.shields.io/coveralls/posthtml/posthtml-cli.svg?style=flat-square\n[style-url]: https://github.com/sindresorhus/xo\n[style]: https://badgen.net/xo/status/chalk?style=flat-square\n","funding_links":["https://patreon.com/posthtml","https://opencollective.com/posthtml"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-cli/lists"}