{"id":15388078,"url":"https://github.com/calebdwilliams/postcss-style-docs","last_synced_at":"2025-04-04T21:13:42.735Z","repository":{"id":57678547,"uuid":"490954095","full_name":"calebdwilliams/postcss-style-docs","owner":"calebdwilliams","description":null,"archived":false,"fork":false,"pushed_at":"2022-05-26T15:18:53.000Z","size":500,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T09:51:37.486Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/calebdwilliams.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-11T04:18:02.000Z","updated_at":"2022-05-11T04:18:26.000Z","dependencies_parsed_at":"2022-09-14T03:23:11.824Z","dependency_job_id":null,"html_url":"https://github.com/calebdwilliams/postcss-style-docs","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calebdwilliams%2Fpostcss-style-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calebdwilliams%2Fpostcss-style-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calebdwilliams%2Fpostcss-style-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/calebdwilliams%2Fpostcss-style-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/calebdwilliams","download_url":"https://codeload.github.com/calebdwilliams/postcss-style-docs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247114062,"owners_count":20885865,"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":"2024-10-01T14:55:25.392Z","updated_at":"2025-04-04T21:13:42.717Z","avatar_url":"https://github.com/calebdwilliams.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-style-docs\n\n[PostCSS] plugin for dynamically adding documentation to styles.\n\n[PostCSS]: https://github.com/postcss/postcss\n\nThe `postcss-style-docs` pluin will walk through your input CSS and create a map of styles to documentation blocks as a message output.\n\n```css\n/**\n * @docs\n * This is a documentation block for the .foo class\n * it can be multiple lines\n */\n.foo {\n  /* Input example */\n}\n```\n\n```css\n.foo {\n  /* Output example */\n}\n```\n\n## Usage\n\n**Step 1:** Install plugin:\n\n```sh\nnpm install --save-dev postcss postcss-style-docs\n```\n\n**Step 2:** The `postcss-style-docs` plugin works best when manually calling `postcss.process` which enables users to get data out of the plugin:\n\n```javascript\nimport postcss from 'postcss';\nimport { getDocs, styleDocsPlugin } from './lib/cjs/index';\n\nconst inputCSS = `\n/**\n * @docs\n * We're doing something really fancy and our users are going\n * to love it.\n */\n.something-fancy {\n  color: tomato;\n}\n\n/** @docs Make it pop */\n.something-fancy--pop {\n  background: papayawhip;\n}\n`;\n\nconst { css, messages } = await postcss([\n  styleDocsPlugin()\n]).process(inputCSS, { from: undefined });\n\nconst docs = getDocs(messages);\n\nconsole.log(docs.size); // 2\nconsole.log(docs.get('.something-fancy')); // 'We're doing something really fancy and our users are going to love it'\nconsole.log(docs.get('.something-fancy--pop')); // 'Make it pop'\n```\n\n[official docs]: https://github.com/postcss/postcss#usage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalebdwilliams%2Fpostcss-style-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalebdwilliams%2Fpostcss-style-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalebdwilliams%2Fpostcss-style-docs/lists"}