CSS Modules Guide
A guide to using CSS Modules for locally-scoped, collision-free CSS class names in modern web applications.
Usage
Ask about CSS Modules setup, composition, TypeScript integration, or scoping strategies.
Examples
- "Set up CSS Modules with TypeScript type generation"
- "How do I compose styles from multiple CSS Module files?"
- "Migrate from global CSS to CSS Modules incrementally"
Guidelines
- Name files with .module.css extension for auto-detection
- Use camelCase class names for easier JavaScript access
- Use composes for sharing styles between modules
- Use :global() sparingly for truly global overrides
- Generate TypeScript declarations for type-safe imports