{"id":13834671,"url":"https://github.com/longlho/ts-transform-css-modules","last_synced_at":"2026-02-11T17:07:08.470Z","repository":{"id":20360354,"uuid":"89756691","full_name":"longlho/ts-transform-css-modules","owner":"longlho","description":"Extract css class names from required css module files for TypeScript","archived":false,"fork":false,"pushed_at":"2023-01-16T10:01:50.000Z","size":288,"stargazers_count":86,"open_issues_count":25,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-02-05T02:32:47.555Z","etag":null,"topics":["ast","compiler","css","css-modules","transform","typescript"],"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/longlho.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}},"created_at":"2017-04-29T01:35:18.000Z","updated_at":"2026-02-04T04:09:47.000Z","dependencies_parsed_at":"2023-01-16T21:46:17.006Z","dependency_job_id":null,"html_url":"https://github.com/longlho/ts-transform-css-modules","commit_stats":null,"previous_names":["longlho/ts-transform-css-modules-transform"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/longlho/ts-transform-css-modules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longlho%2Fts-transform-css-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longlho%2Fts-transform-css-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longlho%2Fts-transform-css-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longlho%2Fts-transform-css-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/longlho","download_url":"https://codeload.github.com/longlho/ts-transform-css-modules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longlho%2Fts-transform-css-modules/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29128626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T17:12:17.649Z","status":"ssl_error","status_checked_at":"2026-02-05T17:11:23.670Z","response_time":65,"last_error":"SSL_read: 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":["ast","compiler","css","css-modules","transform","typescript"],"created_at":"2024-08-04T14:00:50.715Z","updated_at":"2026-02-11T17:07:08.456Z","avatar_url":"https://github.com/longlho.png","language":"TypeScript","readme":"# ts-transform-css-modules\n\n[![Greenkeeper badge](https://badges.greenkeeper.io/longlho/ts-transform-css-modules.svg)](https://greenkeeper.io/)\n[![npm version](https://badge.fury.io/js/ts-transform-css-modules.svg)](https://badge.fury.io/js/ts-transform-css-modules)\n[![travis](https://travis-ci.org/longlho/ts-transform-css-modules.svg?branch=master)](https://travis-ci.org/longlho/ts-transform-css-modules)\n\nExtract css class names from required css module files for TypeScript. This plugin is based on [css-modules-require-hook](https://github.com/css-modules/css-modules-require-hook) and so constructor opts are from that repo.\n\nThis allows you to do this in TS files:\n\n```ts\n// Import works\nimport * as css from 'foo.css'\n// require also works\nconst foo = require('foo.css')\n\nconsole.log(css.foo)\n```\n\nAppend this to `before` in your compilation step. See [compile.ts](https://github.com/longlho/ts-transform-css-modules-transform/blob/master/compile.ts#L30-L32) for more info.\n\nRight now named imports will not work due to TS mangling import name after compilation.\n\n```ts\n// Those are NOT working\nimport css from 'foo.css'\nimport { button, badge } from 'foo.css'\n```\n\n## Options\n\nSee [css-modules-require-hook](https://github.com/css-modules/css-modules-require-hook#tuning-options) for a list of options.\n\n### Custom Options\n\n`tsImportResolver (path: string): string`: This callback function allows you to override import path in `ImportDeclaration` for every CSS file we encounter. This is useful when dealing with project that uses `paths` aliases in tsconfig. This might not be necessary once https://github.com/Microsoft/TypeScript/issues/28276 is resolved.\n\n## Caveats\n\n1. Source map support might not be entirely accurate\n","funding_links":[],"categories":["Transformers"],"sub_categories":["General transformers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonglho%2Fts-transform-css-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flonglho%2Fts-transform-css-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonglho%2Fts-transform-css-modules/lists"}