{"id":22685507,"url":"https://github.com/himanoa/vite-plugin-css-class-name-extractor-for-purescript","last_synced_at":"2026-02-19T10:33:09.076Z","repository":{"id":266308916,"uuid":"897945436","full_name":"himanoa/vite-plugin-css-class-name-extractor-for-purescript","owner":"himanoa","description":"A Vite plugin that enables type-safe usage of CSS Modules in PureScript applications. It automatically generates PureScript APIs and JavaScript FFI code for accessing CSS Module selectors.","archived":false,"fork":false,"pushed_at":"2025-01-09T19:43:24.000Z","size":18256,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-27T12:12:16.223Z","etag":null,"topics":["purescript","vite"],"latest_commit_sha":null,"homepage":"","language":"PureScript","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/himanoa.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-03T14:14:53.000Z","updated_at":"2025-01-09T19:43:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1cacb91-d731-44c2-8fe4-8dc9a1db9e88","html_url":"https://github.com/himanoa/vite-plugin-css-class-name-extractor-for-purescript","commit_stats":null,"previous_names":["himanoa/vite-plugin-css-class-name-extractor-for-purescript"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/himanoa/vite-plugin-css-class-name-extractor-for-purescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanoa%2Fvite-plugin-css-class-name-extractor-for-purescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanoa%2Fvite-plugin-css-class-name-extractor-for-purescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanoa%2Fvite-plugin-css-class-name-extractor-for-purescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanoa%2Fvite-plugin-css-class-name-extractor-for-purescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/himanoa","download_url":"https://codeload.github.com/himanoa/vite-plugin-css-class-name-extractor-for-purescript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/himanoa%2Fvite-plugin-css-class-name-extractor-for-purescript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29609855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["purescript","vite"],"created_at":"2024-12-09T22:15:18.302Z","updated_at":"2026-02-19T10:33:09.035Z","avatar_url":"https://github.com/himanoa.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ClassNameExtractor Vite Plugin\n\nA Vite plugin that enables type-safe usage of CSS Modules in PureScript applications. It automatically generates PureScript APIs and JavaScript FFI code for accessing CSS Module selectors.\n\n## Key Features\n\n- Type-safe PureScript API generation for CSS Module selectors\n- Automatic JavaScript FFI code generation\n- Type-safe configuration support for PureScript\n\n## Installation\n\n```bash\nnpm install vite-plugin-css-class-name-extractor-for-purescript --save-dev\n```\n\n## Usage\n\nJust add the plugin to your vite.config.ts:\n\n```typescript\nimport { defineConfig } from 'vite'\nimport classNameExtractor from 'vite-plugin-css-class-name-extractor-for-purescript'\n\nexport default defineConfig({\n  plugins: [\n    classNameExtractor()\n  ]\n})\n```\n\nThe default configuration includes the following rules:\n\n```typescript\n{\n  rules: {\n    \"src/**/*.module.css\": {\n      replacement: \"\\\\2.Styles\"\n    },\n    \"src/**/*.css\": {\n      replacement: \"\\\\2.Styles\"\n    }\n  }\n}\n```\n\nTo add custom rules, specify glob patterns and their transformation rules:\n\n```typescript\nexport default defineConfig({\n  plugins: [\n    classNameExtractor({\n      rules: {\n        \"src/features/*/components/*/styles.module.css\": {\n          replacement: \"Features.\\\\1.Components.\\\\2.Styles\"\n        }\n      }\n    })\n  ]\n})\n```\n\nPath segments can be referenced in replacement patterns using `\\\\1`, `\\\\2`, etc. For example:\n- `src/components/button/styles.module.css` becomes `Button.Styles`\n- `src/pages/user/profile/styles.module.css` becomes `Profile.Styles`\n\n## Generated Code\n\nGiven a CSS Module file (`Colors.module.css`):\n\n```css\n.wrapper { display: flex; }\n.foo \u003e .bar { display: flex; }\n```\n\nThe plugin generates the following code.\n\n### Generated PureScript Module\n\n`Colors.Styles.purs`:\n```purescript\nmodule Colors.Styles (wrapper, foo, bar) where\n\nforeign import _styles :: String -\u003e String\n\nwrapper :: String\nwrapper = _styles \"wrapper\"\n\nfoo :: String\nfoo = _styles \"foo\"\n\nbar :: String\nbar = _styles \"bar\"\n```\n\n### Generated JavaScript FFI File\n\n`Colors.Styles.js`:\n```javascript\nimport s from \"./Colors.module.css\"\nexport const _styles = (name) =\u003e s[name]\n```\n\nThe generated code provides:\n\n- Type-safe CSS selector references\n- Compile-time type checking\n- IDE code completion support\n\n## License\n\nMIT\n\n## Related\n- [PureScriptでViteのCSSModuleサポートを使う - 遺言書](https://blog.himanoa.net/93/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimanoa%2Fvite-plugin-css-class-name-extractor-for-purescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhimanoa%2Fvite-plugin-css-class-name-extractor-for-purescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhimanoa%2Fvite-plugin-css-class-name-extractor-for-purescript/lists"}