{"id":24983714,"url":"https://github.com/posthtml/express-posthtml","last_synced_at":"2025-10-28T09:31:44.254Z","repository":{"id":3744738,"uuid":"50759778","full_name":"posthtml/express-posthtml","owner":"posthtml","description":"PostHTML for Express","archived":false,"fork":false,"pushed_at":"2023-01-23T22:33:43.000Z","size":2740,"stargazers_count":10,"open_issues_count":14,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T21:06:03.259Z","etag":null,"topics":[],"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":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-31T05:07:09.000Z","updated_at":"2021-09-21T09:44:45.000Z","dependencies_parsed_at":"2023-02-13T04:10:27.030Z","dependency_job_id":null,"html_url":"https://github.com/posthtml/express-posthtml","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fexpress-posthtml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fexpress-posthtml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fexpress-posthtml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fexpress-posthtml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/express-posthtml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299829,"owners_count":20916190,"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":[],"created_at":"2025-02-04T09:20:34.427Z","updated_at":"2025-10-28T09:31:39.206Z","avatar_url":"https://github.com/posthtml.png","language":"JavaScript","readme":"[![npm][npm]][npm-url]\n[![deps][deps]][deps-url]\n[![tests][tests]][tests-url]\n[![coverage][cover]][cover-url]\n[![code style][style]][style-url]\n[![chat][chat]][chat-badge]\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg width=\"200\" height=\"200\" title=\"Express\" hspace=\"50\" src=\"https://i.cloudup.com/zfY6lL7eFa-3000x3000.png\"\u003e\n  \u003ca href=\"https://github.com/posthtml/posthtml\"\u003e\n    \u003cimg width=\"200\" height=\"220\" title=\"PostHTML\" src=\"http://posthtml.github.io/posthtml/logo.svg\"\u003e\n  \u003c/a\u003e\n  \u003ch1\u003eExpress PostHTML\u003c/h1\u003e\n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003eInstall\u003c/h2\u003e\n\n```bash\nnpm i -S express-posthtml\n```\n\n\u003ch2 align=\"center\"\u003eUsage\u003c/h2\u003e\n\n### Engine\n\nRegister PostHTML as Express View Engine\n\n```js\napp.engine('html', require('express-posthtml'))\n```\n\n\u003ch2 align=\"center\"\u003eOptions\u003c/h2\u003e\n\n|Name|Type|Default|Description|\n|:--:|:--:|:-----:|:----------|\n|`plugins`|`{Array}`|`[]`|PostHTML Plugins|\n|`options`|`{Object}`|`{}`|PostHTML Options|\n\n### Global\n\nAll views will render with this setup, if no local setup provided.\n\n```js\napp.set('view options', { plugins: [], options: {} })\n```\n\n```js\nres.render('file.ext')\n```\n\n### Local\n\nView specific setup by adding plugins separately to the respective routes. Note that if you have set plugins globally, routes with local setup will not use the global setup by default.\n\n```js\napp.set('view options', { options: { parser: pug }})\n```\n\n```js\nres.render('file.pug', { plugins: [...plugins] })\n```\n\n### Extend\n\nIf views share common plugins (e.g for [BEM Support][bem]), but view specific additions are necessary, use the extend option. Now the global setup is used and will be extended with the local plugins of the respective route.\n\n[bem]: https://github.com/rajdee/posthtml-bem\n\n```js\napp.set('view options', { plugins: [...plugins], options: {} })\n```\n\n```js\nres.render('file', { plugins: [/* PostHTML Plugins */], extend: true })\n```\n\n\u003ch2 align=\"center\"\u003eExample\u003c/h2\u003e\n\n```js\nimport express from 'express'\nimport posthtml from 'express-posthtml'\n\nconst app = express()\n\napp.engine('html', posthtml)\n\nconst plugins = [\n  require('posthtml-bem')(),\n  require('posthtml-expressions')()\n]\nconst options = {}\n\napp.set('views', /* Path to views */)\napp.set('view options', { plugins: plugins, options: options })\n\napp.get('/', (req, res) =\u003e res.render('index.html'))\n\napp.listen(3000)\n```\n\n\u003ch2 align=\"center\"\u003eMaintainers\u003c/h2\u003e\n\n\u003ctable\u003e\n  \u003ctbody\u003e\n   \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\n      \u003cimg width=\"150 height=\"150\"\n      src=\"https://avatars.githubusercontent.com/u/5419992?v=3\u0026s=150\"\u003e\n      \u003cbr /\u003e\n      \u003ca href=\"https://github.com/michael-ciniawsky\"\u003eMichael Ciniawsky\u003c/a\u003e\n    \u003c/td\u003e\n   \u003c/tr\u003e\n  \u003ctbody\u003e\n\u003c/table\u003e\n\n[npm]: https://img.shields.io/npm/v/express-posthtml.svg\n[npm-url]: https://npmjs.com/package/express-posthtml\n\n[node]: https://img.shields.io/node/v/postcss-load-plugins.svg\n[node-url]: https://nodejs.org/\n\n[deps]: https://david-dm.org/posthtml/express-posthtml.svg\n[deps-url]: https://david-dm.org/posthtml/express-posthtml\n\n[style]: https://img.shields.io/badge/code%20style-standard-yellow.svg\n[style-url]: http://standardjs.com/\n\n[tests]: http://img.shields.io/travis/posthtml/express-posthtml.svg\n[tests-url]: https://travis-ci.org/posthtml/express-posthtml\n\n[cover]: https://coveralls.io/repos/github/posthtml/express-posthtml/badge.svg\n[cover-url]: https://coveralls.io/github/posthtml/express-posthtml\n\n[chat]: https://badges.gitter.im/posthtml/posthtml.svg\n[chat-badge]: https://gitter.im/posthtml/posthtml?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge\"\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fexpress-posthtml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fexpress-posthtml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fexpress-posthtml/lists"}