{"id":24983658,"url":"https://github.com/posthtml/posthtml-postcss-modules","last_synced_at":"2025-12-16T13:04:01.345Z","repository":{"id":57328835,"uuid":"59301686","full_name":"posthtml/posthtml-postcss-modules","owner":"posthtml","description":"PostCSS CSS Modules Plugin","archived":false,"fork":false,"pushed_at":"2019-07-02T07:36:57.000Z","size":43,"stargazers_count":20,"open_issues_count":1,"forks_count":3,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-14T01:24:19.319Z","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":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-20T14:35:28.000Z","updated_at":"2024-04-04T14:44:47.000Z","dependencies_parsed_at":"2022-09-13T05:50:22.794Z","dependency_job_id":null,"html_url":"https://github.com/posthtml/posthtml-postcss-modules","commit_stats":null,"previous_names":["canvaskisa/posthtml-postcss-modules"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/posthtml/posthtml-postcss-modules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-postcss-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-postcss-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-postcss-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-postcss-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-postcss-modules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-postcss-modules/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260994008,"owners_count":23094279,"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:03.905Z","updated_at":"2025-12-16T13:03:56.302Z","avatar_url":"https://github.com/posthtml.png","language":"JavaScript","readme":"[![NPM][npm]][npm-url]\n[![Deps][deps]][deps-url]\n[![Tests][travis]][travis-url]\n[![Coverage][cover]][cover-url]\n[![XO Code Style][style]][style-url]\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/posthtml/posthtml\"\u003e\n    \u003cimg width=\"180\" height=\"180\" src=\"http://posthtml.github.io/posthtml/logo.svg\"\u003e\n  \u003c/a\u003e\n  \u003cimg width=\"108\" height=\"108\" title=\"PostCSS\"                 src=\"http://postcss.github.io/postcss/logo.svg\" hspace=\"20\"\u003e\n  \u003cimg width=\"150\" height=\"150\"  src=\"https://raw.githubusercontent.com/css-modules/logos/master/css-modules-logo.png\" /\u003e\n  \u003ch1\u003ePostCSS Modules Plugin\u003c/h1\u003e\n  \u003cp\u003eA plugin to modules resources with ease\u003cp\u003e\n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003eInstall\u003c/h2\u003e\n\n```bash\nnpm i -D posthtml-postcss-modules\n```\n\n\u003ch2 align=\"center\"\u003eUsage\u003c/h2\u003e\n\n```js\noptions = {\n  root: './', // root path for links lookup\n  from: '' // pathname to resolving file (it's always better to provide it)\n  plugins: [], // postcss plugins to apply for every link\n  generateScopedName: genericNames // function to process css names or string\n};\n```\n\n### Related\n\n[CSS Modules](https://github.com/css-modules/css-modules)\n\n\u003ch2 align=\"center\"\u003eExample\u003c/h2\u003e\n\n```html\n\u003c!-- header.html --\u003e\n\u003clink href=\"header.css\" module/\u003e\n\n\u003cstyle module\u003e\n  .navigation {height: 100px;}\n\u003c/style\u003e\n\n\u003cheader classname=\"root\"\u003e\n  \u003cnav classname=\"root navigation\"\u003e\n  \u003c/nav\u003e\n\u003c/header\u003e\n```\n\n```css\n/* header.css */\n.root {background-color: white;}\n```\n\n```js\nconst { readFileSync } = require('fs')\nconst posthtml = require('posthtml')\n\nposthtml()\n  .use(require('posthtml-postcss-modules')({\n    generateScopedName: '[hash:base64:5]'\n  }))\n  .process(readFileSync('header.html', 'utf8'))\n  .then((result) =\u003e result)\n  })\n```\n\n```html\n \u003cstyle\u003e.wqroe {background-color: white;}\u003c/style\u003e\n \u003cstyle\u003e._32Lja {height: 100px;}\u003c/style\u003e\n\n \u003cheader class=\"wqroe\"\u003e\n    \u003cnav class=\"wqroe _32Lja\"\u003e\u003c/nav\u003e\n \u003c/header\u003e\n```\n\n\u003ch2 align=\"center\"\u003eLICENSE\u003c/h2\u003e\n\nMIT License (MIT)\n\nCopyright (c) 2016 PostHTML [Aleksandr Yakunichev](https://github.com/canvaskisa)\n\n\u003e Permission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\n\u003e The above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n[npm]: https://img.shields.io/npm/v/posthtml-postcss-modules.svg\n[npm-url]: https://npmjs.com/package/posthtml-postcss-modules\n\n[deps]: https://david-dm.org/posthtml/posthtml-postcss-modules.svg\n[deps-url]: https://david-dm.org/posthtml/posthtml-postcss-modules\n\n[style]: https://img.shields.io/badge/code_style-XO-5ed9c7.svg\n[style-url]: https://github.com/sindresorhus/xo\n\n[travis]: http://img.shields.io/travis/posthtml/posthtml-postcss-modules.svg\n[travis-url]: https://travis-ci.org/posthtml/posthtml-postcss-modules\n\n[cover]: https://coveralls.io/repos/github/posthtml/posthtml-postcss-modules/badge.svg?branch=master\n[cover-url]: https://coveralls.io/github/posthtml/posthtml-postcss-modules?branch=master\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-postcss-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-postcss-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-postcss-modules/lists"}