An open API service indexing awesome lists of open source software.

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

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"]}`