{"id":14990598,"url":"https://github.com/activeguild/typescript-plugin-css-modules-vite","last_synced_at":"2025-04-12T02:25:20.009Z","repository":{"id":45982927,"uuid":"425004426","full_name":"activeguild/typescript-plugin-css-modules-vite","owner":"activeguild","description":"Read the definition of vite.config.ts and resolve the CSS Modules type. Supports sass.","archived":false,"fork":false,"pushed_at":"2023-06-29T08:59:37.000Z","size":375,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T02:25:09.337Z","etag":null,"topics":["cssmodules","plugin","typescript","vite"],"latest_commit_sha":null,"homepage":"","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/activeguild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-05T15:54:51.000Z","updated_at":"2024-08-29T08:33:11.000Z","dependencies_parsed_at":"2024-06-19T13:33:01.539Z","dependency_job_id":"3e274c07-cf82-443a-8817-f8019cc9d217","html_url":"https://github.com/activeguild/typescript-plugin-css-modules-vite","commit_stats":null,"previous_names":["activeguild/ts-css-modules-vite-plugin"],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activeguild%2Ftypescript-plugin-css-modules-vite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activeguild%2Ftypescript-plugin-css-modules-vite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activeguild%2Ftypescript-plugin-css-modules-vite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/activeguild%2Ftypescript-plugin-css-modules-vite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/activeguild","download_url":"https://codeload.github.com/activeguild/typescript-plugin-css-modules-vite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248506341,"owners_count":21115419,"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":["cssmodules","plugin","typescript","vite"],"created_at":"2024-09-24T14:20:26.181Z","updated_at":"2025-04-12T02:25:19.980Z","avatar_url":"https://github.com/activeguild.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003ets-css-modules-vite-plugin ⚡ Welcome 😀\u003c/h1\u003e\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://github.com/actions/setup-node\"\u003e\u003cimg alt=\"GitHub Actions status\" src=\"https://github.com/activeguild/ts-css-modules-vite-plugin/workflows/automatic%20release/badge.svg\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# ts-css-modules-vite-plugin\n\nRead the definition of `vite.config.ts` and resolve the `CSS Modules` type.\nSupports `sass`.\n\n## Demo\n\n\u003cimg src=\"https://user-images.githubusercontent.com/39351982/141417812-4b4b3963-897f-4dce-840d-a0bb04a82bd1.gif\" width=\"600\" /\u003e\n\n## Install\n\n```bash\nnpm i -D ts-css-modules-vite-plugin\n```\n\n## Options\n\n| Parameter | Type   | Description                                                                            |\n| --------- | ------ | -------------------------------------------------------------------------------------- |\n| root      | string | Set the relative path from the project root to the 'vite.config.ts' file. (default ./) |\n\n## Add it to the `tsconfig.json`\n\n```json\n{\n  \"compilerOptions\": {\n    ...\n    \"plugins\": [{\"name\": \"ts-css-modules-vite-plugin\", \"root\": \"./\"}]\n  },\n}\n```\n\n## Resolve the `vite.config.ts`\n\nResolve the `preprocessorOptions` setting within the plugin.\n\n```ts\nimport path from \"path\";\nimport { defineConfig } from \"vite\";\n\nexport default defineConfig({\n  css: {\n    preprocessorOptions: {\n      scss: {\n        additionalData: `@use \"@/styles\" as common;`,\n        importer(...args) {\n          if (args[0] !== \"@/styles\") {\n            return;\n          }\n\n          return {\n            file: `${path.resolve(__dirname, \"./src/assets/styles\")}`,\n          };\n        },\n      },\n    },\n  },\n});\n```\n\n## Using VS Code\n\nThe VScode typescript version needs to match the project.\nSet the following.\n\n```json\n{\n  \"typescript.tsdk\": \"node_modules/typescript/lib\"\n}\n```\n\nUse the workspace version.\n![スクリーンショット 2022-12-23 23 20 51](https://user-images.githubusercontent.com/39351982/209350906-4eaef407-6a69-49b0-99a7-43ccd46c449e.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factiveguild%2Ftypescript-plugin-css-modules-vite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factiveguild%2Ftypescript-plugin-css-modules-vite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factiveguild%2Ftypescript-plugin-css-modules-vite/lists"}