{"id":14990568,"url":"https://github.com/posthtml/posthtml-css-modules","last_synced_at":"2025-10-10T21:14:54.087Z","repository":{"id":57328795,"uuid":"51245957","full_name":"posthtml/posthtml-css-modules","owner":"posthtml","description":"Use CSS modules in HTML","archived":false,"fork":false,"pushed_at":"2017-09-03T07:42:13.000Z","size":17,"stargazers_count":55,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-01T12:35:06.966Z","etag":null,"topics":["css-modules","posthtml"],"latest_commit_sha":null,"homepage":null,"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":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-07T11:58:14.000Z","updated_at":"2024-12-10T18:28:56.000Z","dependencies_parsed_at":"2022-09-12T10:42:00.177Z","dependency_job_id":null,"html_url":"https://github.com/posthtml/posthtml-css-modules","commit_stats":null,"previous_names":["maltsev/posthtml-css-modules"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/posthtml/posthtml-css-modules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-css-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-css-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-css-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-css-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posthtml","download_url":"https://codeload.github.com/posthtml/posthtml-css-modules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posthtml%2Fposthtml-css-modules/sbom","scorecard":{"id":741822,"data":{"date":"2025-08-11","repo":{"name":"github.com/posthtml/posthtml-css-modules","commit":"47d2ffa908a9085265fe2a60ef608feed33ebdbd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":1,"reason":"Found 3/26 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T17:38:34.540Z","repository_id":57328795,"created_at":"2025-08-22T17:38:34.540Z","updated_at":"2025-08-22T17:38:34.540Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005412,"owners_count":26083883,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["css-modules","posthtml"],"created_at":"2024-09-24T14:20:23.460Z","updated_at":"2025-10-10T21:14:54.071Z","avatar_url":"https://github.com/posthtml.png","language":"JavaScript","readme":"# posthtml-css-modules\n[![npm version](https://badge.fury.io/js/posthtml-css-modules.svg)](http://badge.fury.io/js/posthtml-css-modules)\n[![Build Status](https://travis-ci.org/posthtml/posthtml-css-modules.svg?branch=master)](https://travis-ci.org/posthtml/posthtml-css-modules)\n\n[PostHTML](https://github.com/posthtml/posthtml) plugin that inlines [CSS modules](https://github.com/css-modules/css-modules) in HTML.\n\n\n## Usage\nI suggest using [postcss-modules](https://github.com/outpunk/postcss-modules) to generate CSS modules.\nCheck [the PostHTML documentation](https://github.com/posthtml/posthtml#usage) for integration examples with grunt, gulp, and other build systems.\n\nIf you're more into webpack then you don't need all these modules at all.\nWith `css`, `style`, and `html` loaders you can achieve the same result:\n[css-modules-webpack-example](https://github.com/maltsev/css-modules-webpack-example)\n\n### Global file\nLet's say we have `cssClasses.json` with all CSS modules inside:\n```json\n{\n  \"title\": \"_title_116zl_1 _heading_9dkf\",\n  \"profile\": {\n    \"user\": \"_profile_user_f93j\"\n  }\n}\n```\n\nNow we can inline these CSS modules in our HTML:\n```js\nvar posthtml = require('posthtml');\n\nposthtml([require('posthtml-css-modules')('./cssClasses.json')])\n    .process(\n        '\u003ch1 css-module=\"title\"\u003eMy profile\u003c/h1\u003e' +\n        // You can also use nested modules\n        '\u003cdiv css-module=\"profile.user\"\u003eJohn\u003c/div\u003e'\n    )\n    .then(function (result) {\n        console.log(result.html);\n    });\n\n// \u003ch1 class=\"_title_116zl_1 _heading_9dkf\"\u003eMy profile\u003c/h1\u003e\n// \u003cdiv class=\"_profile_user_f93j\"\u003eJohn\u003c/div\u003e\n```\n\n### Directory with several files\nCSS modules could be also separated into several files.\nFor example, `profile.js` and `article.js` inside directory `cssModules/`:\n```js\n// profile.js\nmodule.exports = {\n  user: '_profile_user_f93j'\n}\n```\n\n```js\n// article.js\nmodule.exports = {\n  title: '_article__tile _heading'\n}\n```\nYou can use both JS and JSON for a declaration, as long as the file could be required via `require()`.\n\n```js\nvar posthtml = require('posthtml');\n\nposthtml([require('posthtml-css-modules')('./cssModules/')])\n    .process(\n        '\u003cdiv class=\"baseWrapper\" css-module=\"profile.user\"\u003eJohn\u003c/div\u003e' +\n        '\u003ch2 css-module=\"article.title\"\u003e\u003c/h2\u003e'\n    )\n    .then(function (result) {\n        console.log(result.html);\n    });\n\n// \u003cdiv class=\"baseWrapper _profile_user_f93j\"\u003eJohn\u003c/div\u003e\n// \u003ch2 class=\"_article__tile _heading\"\u003e\u003c/h2\u003e\n```\n\n\n### Object\nYou can also pass CSS modules as an object to the plugin:\n```js\nvar posthtml = require('posthtml'),\n    cssModules = {\n        title: \"_title_116zl_1 _heading_9dkf\",\n        profile: {\n            user: \"_profile_user_f93j\"\n        }\n    };\n\nposthtml([require('posthtml-css-modules')(cssModules)])\n    .process(\n        '\u003ch1 css-module=\"title\"\u003eMy profile\u003c/h1\u003e' +\n        // You can also use nested modules\n        '\u003cdiv css-module=\"profile.user\"\u003eJohn\u003c/div\u003e'\n    )\n    .then(function (result) {\n        console.log(result.html);\n    });\n\n// \u003ch1 class=\"_title_116zl_1 _heading_9dkf\"\u003eMy profile\u003c/h1\u003e\n// \u003cdiv class=\"_profile_user_f93j\"\u003eJohn\u003c/div\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-css-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposthtml%2Fposthtml-css-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposthtml%2Fposthtml-css-modules/lists"}