css-modules-and-sass
/css-modules-and-sass
Utrzymuje zakresowe style komponentów, miksiny Sass, zagnieżdżone reguły i zmienne w CSS Modules i Sass/SCSS.
- Autor
- nextboxis ↗
- Repozytorium
- library-skill-agents ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 28.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 28.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Utrzymuje zakresowe style komponentów, miksiny Sass, zagnieżdżone reguły i zmienne w CSS Modules i Sass/SCSS.
Oryginalny opis (EN)
Use this skill when maintaining scoped component styles, Sass mixins, nested rules, and variables using CSS Modules and Sass/SCSS.
Jak działa
- When to use
- Prerequisites
- Step-by-step workflow
- Commands / code examples
- Common mistakes & pitfalls
- Verification checklist
- Related skills
Podgląd SKILL.md
---
name: css-modules-and-sass
description: Use this skill when maintaining scoped component styles, Sass mixins, nested rules, and variables using CSS Modules and Sass/SCSS.
---
# CSS Modules and Sass
## When to use
Use this skill in projects requiring localized, collision-free CSS class scoping combined with Sass preprocessing features like mixins and color functions.
## Prerequisites
- Modern frontend build tool (Vite, Webpack, or Next.js) with `sass-embedded` or `sass` installed.
- Understanding of CSS specificity and preprocessor compilation.
## Step-by-step workflow
1. **Name module files**: Create stylesheet files following the `.module.scss` or `.module.css` naming convention next to the target component.
2. **Define component classes**: Author clean, human-readable class names without artificial BEM prefixing (scoping hashes are added at build time).
3. **Leverage Sass mixins and functions**: Encapsulate complex vendor prefixes or reusable typography rules inside centralized Sass partials (`_mixins.scss`).
4. **Import and bind classes**: Import the styles object into the component file and assign classes using property lookup (`styles.header`).
5. **Handle dynamic states**: Combine multiple module classes dynamically using template strings or utility helpers like `clsx`.
## Commands / code examples
```scss
// Modal.module.scss
@use 'styles/variables' as vars;
@use 'styles/mixins' as mixins;
.overlay {
position: fixed;
inset: 0;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.modalWindow {
background: vars.$bg-surface;
border-radius: vars.$radius-lg;
padding: 1.5rem;
max-width: 500px;
width: 90%;
box-shadow: vars.$shadow-elevation-high;
@include mixins.respond-to('md') {
padding: 2rem;
}
}
.title {
font-size: 1.25rem;
font-weight: 600;
color: vars.$text-primary;
}
```
```tsx
// Modal.tsx
import React from 'react';
import styles from './Modal.module.scss';
export const Modal: React.FC<{ title: string; children: React.ReactNode }> = ({ title, children }) => {
return (
<div className={styles.overlay} role="dialog" aria-modal="true">
<div className={styles.modalWindow}>
<h2 className={styles.title}>{title}</h2>
{children}
</div>
</div>
);
};
```
## Common mistakes & pitfalls
- Referencing undefined class names on the imported `styles` object without TypeScript type checking (`typed-css-modules`).
- Overusing deeply nested Sass selectors, creating unnecessarily high specificity.
- Relying on `:global()` excessively, bypassing modular encapsulation.
## Verification checklist
- [ ] Stylesheets use `.module.scss` or `.module.css` extensions.
- [ ] Classes are referenced through the imported `styles` object.
- [ ] Shared variables and mixins are imported via `@use` rather than legacy `@import`.
- [ ] No global scope pollution occurs outside intentional `:global()` blocks.
## Related skills
- modern-css-layout-grid-flexbox
- styled-components-emotion
- react-fundamentals
- tailwindcss-architecture
Wersje
W bazie nie ma innych skilli o nazwie css-modules-and-sass.
Migawka bazy z 13.11.2026 · wersja paczki e9c1e0c1166e (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 1 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 90fe-sass
Pisze i przegląda kod Sass dla Dart Sass, z systemem modułów @use i @forward, i wskazuje, kiedy wystarczy zwykły CSS. - 85sass-scss-optimizer
Audytuje i optymalizuje Sass i SCSS: migrację z @import do @use, przestarzałe funkcje kolorów, rozmiar wyjścia i map źródłowych, z pomiarami. - 90astro-styling
Stylizuje komponenty Astro: scoped CSS, CSS Modules, Tailwind CSS, UnoCSS, Sass, dyrektywa class:list i style globalne. - 100bootstrap-component
Buduje CSS i znaczniki komponentu Bootstrap 6: nowe komponenty, warianty i style z mapami tokenów Sass oraz nadpisaniami motywu. - 95phy-css-dead-code
Wykrywa nieużywany CSS i martwe selektory przez porównanie arkuszy ze wszystkimi plikami HTML, JSX, TSX, Vue i szablonami, z uwzględnieniem Tailwind, Bootstrap, CSS Modules i Sass, oraz szacuje oszczędność bajtów. - 90code-style-css
Podpowiada zasady stylu przy edycji CSS, SCSS i bloków stylów w plikach Svelte.