{"id":25656401,"url":"https://github.com/dogma-io/babel-plugin-auto-css-modules","last_synced_at":"2026-04-09T16:09:51.160Z","repository":{"id":30857161,"uuid":"116534251","full_name":"dogma-io/babel-plugin-auto-css-modules","owner":"dogma-io","description":"Automatically import same name CSS modules.","archived":false,"fork":false,"pushed_at":"2023-01-04T21:50:36.000Z","size":1585,"stargazers_count":1,"open_issues_count":17,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T20:41:39.958Z","etag":null,"topics":["babel","babel-plugin","css","css-modules","import","modules","require"],"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/dogma-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-07T03:30:26.000Z","updated_at":"2020-04-11T10:13:51.000Z","dependencies_parsed_at":"2023-01-14T18:00:35.698Z","dependency_job_id":null,"html_url":"https://github.com/dogma-io/babel-plugin-auto-css-modules","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogma-io%2Fbabel-plugin-auto-css-modules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogma-io%2Fbabel-plugin-auto-css-modules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogma-io%2Fbabel-plugin-auto-css-modules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogma-io%2Fbabel-plugin-auto-css-modules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dogma-io","download_url":"https://codeload.github.com/dogma-io/babel-plugin-auto-css-modules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240390498,"owners_count":19793780,"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":["babel","babel-plugin","css","css-modules","import","modules","require"],"created_at":"2025-02-23T22:32:51.753Z","updated_at":"2026-04-09T16:09:51.118Z","avatar_url":"https://github.com/dogma-io.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-plugin-auto-css-modules [![NPM][npm-img]][npm-url] [![Coverage][cov-img]][cov-url]\n\nAutomatically import same name CSS modules.\n\n## Table of Contents\n\n*   [Installation](#installation)\n*   [Documentation](#documentation)\n*   [Code of Conduct](#code-of-conduct)\n*   [Contributing](#contributing)\n*   [License](#license)\n\n## Installation\n\n**npm**\n\n```bash\nnpm install babel-plugin-auto-css-modules\n```\n\n**yarn**\n\n```bash\nyarn add babel-plugin-auto-css-modules\n```\n\n\n## Documentation\n\nFor any Javascript modules that you want corresponding CSS simply create a CSS file with the extension `.css` and the same name as your Javascript module in the same directory as your Javascript module. For example if you have a component at `foo/bar/Baz.js` your corresponding CSS would live at `foo/bar/Baz.css`.\n\nThen in your Babel configuration include:\n```js\nconst plugins = []\n\n// Omit CSS modules in the test environment as Jest doesn't know how to handle\n// them and they provide no value to Jest tests anyways.\nif (NODE_ENV !== 'test') {\n  plugins.push('babel-plugin-auto-css-modules')\n}\n\nmodule.exports = {\n  plugins,\n}\n```\n\nThis plugin will then automatically inject import statements into your Javascript modules to reference the CSS modules. Given the above example, `foo/bar/Baz.js` would get `import \"foo/bar/Baz.css\"` at the top of the file.\n\nFrom here you'll need to configure your bundler of choice to handle CSS modules. If you're using Webpack you may want to check out [postcss-loader](https://github.com/postcss/postcss-loader).\n\n## Code of Conduct\n\nPlease see the [code of conduct](CODE_OF_CONDUCT.md).\n\n## Contributing\n\nPlease see the [contributing guide](CONTRIBUTING.md).\n\n## License\n\n[MIT](LICENSE.md)\n\n[cov-img]: https://img.shields.io/codecov/c/github/dogma-io/babel-plugin-auto-css-modules.svg \"Code Coverage\"\n[cov-url]: https://codecov.io/gh/dogma-io/babel-plugin-auto-css-modules\n\n[npm-img]: https://img.shields.io/npm/v/babel-plugin-auto-css-modules.svg \"NPM Version\"\n[npm-url]: https://www.npmjs.com/package/babel-plugin-auto-css-modules\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdogma-io%2Fbabel-plugin-auto-css-modules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdogma-io%2Fbabel-plugin-auto-css-modules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdogma-io%2Fbabel-plugin-auto-css-modules/lists"}