docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거

Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,171 @@
---
id: wiki-2026-0508-css-modules
title: CSS Modules
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [CSS Module, Locally-Scoped CSS]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [css, frontend, scoping, build-tool]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: css
framework: webpack/vite
---
# CSS Modules
## 매 한 줄
> **"매 class 가 file-locally scoped"**. CSS Modules 매 build-time transform 으로 매 class name 을 unique hash 로 rewriting — 매 global namespace pollution 의 elimination + component-level encapsulation 의 enable. 매 2026 현재 Vite/Webpack/Next.js 매 native support, 매 CSS-in-JS runtime cost 의 alternative 로 주류.
## 매 핵심
### 매 작동 원리
- `Button.module.css` 매 import 시 매 bundler 가 매 class 를 `Button_primary__a3fG2` 로 rename.
- 매 import 결과 매 object — `{ primary: 'Button_primary__a3fG2' }`.
- 매 component 매 `styles.primary` 로 reference — 매 collision-free.
### 매 vs alternatives
- **vs global CSS**: 매 scoping 자동, 매 BEM 매 manual convention 의 replacement.
- **vs CSS-in-JS**: 매 zero runtime, 매 build-time only — 매 bundle size + perf 우위.
- **vs Tailwind**: 매 component-local custom design 매 적합, Tailwind 매 utility-first.
### 매 응용
1. Component library (Button, Input) 매 encapsulated styling.
2. Next.js 매 default-supported pattern — `*.module.css` 매 convention.
3. Design system 매 token + component 매 layered structure.
## 💻 패턴
### Basic usage
```css
/* Button.module.css */
.primary {
background: #0070f3;
color: white;
padding: 8px 16px;
border-radius: 4px;
}
.disabled {
opacity: 0.5;
cursor: not-allowed;
}
```
```tsx
// Button.tsx
import styles from './Button.module.css';
export function Button({ disabled, children }: Props) {
return (
<button
className={`${styles.primary} ${disabled ? styles.disabled : ''}`}
disabled={disabled}
>
{children}
</button>
);
}
```
### Composition (`composes`)
```css
/* base.module.css */
.button {
font: inherit;
cursor: pointer;
}
/* Button.module.css */
.primary {
composes: button from './base.module.css';
background: #0070f3;
}
```
### `clsx` 와 conditional classes
```tsx
import clsx from 'clsx';
import styles from './Card.module.css';
export function Card({ variant, active }: Props) {
return (
<div className={clsx(styles.card, styles[variant], active && styles.active)}>
...
</div>
);
}
```
### TypeScript typed module
```ts
// Button.module.css.d.ts (auto-generated by typescript-plugin-css-modules)
declare const styles: {
readonly primary: string;
readonly disabled: string;
};
export default styles;
```
### `:global` escape hatch
```css
/* Layout.module.css */
.root :global(.markdown) h1 {
/* unscoped — for third-party HTML */
font-size: 2rem;
}
```
### Vite config
```ts
// vite.config.ts
export default {
css: {
modules: {
localsConvention: 'camelCaseOnly',
generateScopedName: '[name]__[local]__[hash:base64:5]',
},
},
};
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Component-scoped styling, zero runtime | **CSS Modules** |
| Dynamic styles (props-driven) | CSS-in-JS (vanilla-extract, styled-components) |
| Utility-first, rapid prototyping | Tailwind |
| Server Components 매 styling | CSS Modules (Tailwind 도 OK) |
**기본값**: Next.js / Vite 매 component-level styling 의 first choice 로 **CSS Modules**.
## 🔗 Graph
- 변형: [[CSS_Architecture_and_Styling|CSS-in-JS]] · [[CSS_Architecture_and_Styling|Tailwind CSS]] · [[BEM]]
- 응용: [[Next.js]] · [[Vite]] · [[React]]
- Adjacent: [[Vanilla-Extract]]
## 🤖 LLM 활용
**언제**: component encapsulation 매 필요, runtime cost 의 회피, TypeScript-friendly typing.
**언제 X**: 매 dynamic theming 매 heavy (variant explosion), 매 design token 매 runtime mutation 매 필요 — vanilla-extract / CSS variables.
## ❌ 안티패턴
- **`:global` 매 남용**: 매 scoping benefit 의 nullification.
- **String concatenation 매 raw**: 매 `clsx` 의 사용 — 매 readability + falsy handling.
- **`styles['kebab-case']` access 매 unnecessarily**: 매 `localsConvention: 'camelCaseOnly'` 매 설정.
- **Module 1개 매 100+ classes**: 매 split — 매 component-per-module.
## 🧪 검증 / 중복
- Verified (Next.js docs 2026, Vite CSS Modules guide).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — CSS Modules build-time scoping + composition + Vite/Next 통합 |