Skip to content

andriyor/css-modules-migration

Repository files navigation

migrate-to-css-modules

Idea of project based on this article How we migrated entirely to CSS Modules using codemods and Sourcegraph Code Insights

sourcegraph/codemod: A collection of codemods powered by TS-Morph and PostCSS

add clsx as option for className by andriyor · Pull Request #189 · sourcegraph/codemod

Supported migrations

  • import './App.scss'; to import styles from './App.module.scss';
  • className='App' to className={styles.App}
  • id='idSelector' to id={styles.idSelector}
  • className='selector1 selector2' to className={`${styles.selector1} ${styles.selector2}`}
  • className='d-flex menu' to className={`d-flex ${styles.menu}`}
  • className={["listRule1", "listRule2"].join(" ")} to className={[styles.listRule1, styles.listRule2].join(" ")}
  • className="kebab-case" to className={styles["kebab-case"]}