Skip to content

Instantly share code, notes, and snippets.

/**
* Run `node css.js` from this package root to compile every `*.module.scss` to a sibling `*.module.css` and rewrite imports accordingly.
*
* - Scans the package for `*.module.scss` files (ignoring node_modules, lib, lib-esm, .turbo, .git, dist, build, etc.).
* - Compiles each of them with `sass` into a `*.module.css` that sits in the same folder.
* - Updates `.js`, `.jsx`, `.ts`, and `.tsx` files so `.module.scss` imports point to the new `.module.css` files.
* - Optionally deletes the original `*.module.scss` files after successful compilation (use --delete flag).
*
* Usage:
* node css.js # Compile and update imports (keep .scss files)