https://github.com/andriyor/css-modules-migration
Experiment with migrattion from css to css-modules
https://github.com/andriyor/css-modules-migration
ast css css-modules migration ts-morph
Last synced: 1 day ago
JSON representation
Experiment with migrattion from css to css-modules
- Host: GitHub
- URL: https://github.com/andriyor/css-modules-migration
- Owner: andriyor
- Created: 2023-02-04T16:05:59.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-09-29T08:24:12.000Z (over 2 years ago)
- Last Synced: 2025-12-26T17:48:34.666Z (29 days ago)
- Topics: ast, css, css-modules, migration, ts-morph
- Language: TypeScript
- Homepage:
- Size: 211 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# migrate-to-css-modules
Idea of project based on this article [How we migrated entirely to CSS Modules using codemods and Sourcegraph Code Insights](https://about.sourcegraph.com/blog/migrating-to-css-modules-with-codemods-and-code-insights)
[sourcegraph/codemod: A collection of codemods powered by TS-Morph and PostCSS](https://github.com/sourcegraph/codemod)
[add clsx as option for className by andriyor · Pull Request #189 · sourcegraph/codemod](https://github.com/sourcegraph/codemod/pull/189)
## Supported migrations
- [x] `import './App.scss';` to `import styles from './App.module.scss';`
- [x] `className='App'` to `className={styles.App}`
- [x] `id='idSelector'` to `id={styles.idSelector}`
- [x] `className='selector1 selector2'` to `` className={`${styles.selector1} ${styles.selector2}`} ``
- [x] `className='d-flex menu'` to `` className={`d-flex ${styles.menu}`} ``
- [x] `className={["listRule1", "listRule2"].join(" ")}` to `className={[styles.listRule1, styles.listRule2].join(" ")}`
- [x] `className="kebab-case"` to `className={styles["kebab-case"]}`