--- name: rasengan-styling description: Styling patterns for Rasengan.js. Covers CSS Modules (scoped styles), Tailwind CSS integration (v3/v4), and CSS preprocessors (Sass, Less, Stylus). Use when adding or configuring styling in a Rasengan.js project. license: MIT metadata: author: dilane3 framework: rasengan version: '1.0.0' --- # Rasengan.js Styling Patterns ## When to Activate - Adding CSS Modules for component-scoped styles - Setting up Tailwind CSS (v3 or v4) in a Rasengan.js project - Configuring Sass, Less, or Stylus preprocessors - Importing global styles or external stylesheets - Choosing between styling approaches for a new project ## CSS Modules Rasengan.js has built-in support for CSS Modules using the `.module.css` extension. Class names are auto-scoped to the component. ```tsx import styles from './Card.module.css'; type CardProps = { title: string; content: string }; export default function Card({ title, content }: CardProps) { return (

{title}

{content}

); } ``` ### Global Styles Place global styles in `src/styles/` and import them in `src/main.tsx`: ```css /* src/styles/index.css */ body, html { margin: 0; padding: 0; width: 100vw; min-height: 100vh; } ``` ```tsx // src/main.tsx import '@/styles/index.css'; import { type AppProps } from 'rasengan'; import AppRouter from '@/app/app.router'; export default function App({ Component, children }: AppProps) { return {children}; } ``` ### External Stylesheets Import package stylesheets in `src/main.tsx` or load CDN stylesheets in `src/template.tsx`: ```tsx // src/main.tsx — package styles import '@rasenganjs/image/css'; // src/template.tsx — CDN styles import { type TemplateProps } from 'rasengan'; export default function Template({ Head, Body, Script }: TemplateProps) { return (