9148c358d0
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 폴더 제거.
4.4 KiB
4.4 KiB
id, title, category, status, source_trust_level, verification_status, created_at, updated_at, tags, tech_stack, applied_in, aliases
| id | title | category | status | source_trust_level | verification_status | created_at | updated_at | tags | tech_stack | applied_in | aliases | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| frontend-tailwind-architecture | Tailwind CSS — 디자인 토큰 / 컴포넌트 / 조직 | Coding | draft | B | conceptual | 2026-05-09 | 2026-05-09 |
|
|
|
Tailwind Architecture
Utility-first. className spam 이 아닌 컴포넌트 추출 + cva 변형.
tailwind.config.ts의 theme 가 디자인 시스템. v4 = CSS-first config.
📖 핵심 개념
- Utility-first: 미리 만든 작은 클래스 조합.
- Theme: 색 / 크기 / 폰트 = 디자인 토큰.
cva: variants + compoundVariants 로 component variant 정의.tw-merge: 충돌하는 클래스 (p-2 p-4) 자동 정리.
💻 코드 패턴
theme = 디자인 토큰 (v3)
// tailwind.config.ts
import type { Config } from 'tailwindcss';
export default {
content: ['./src/**/*.{ts,tsx}'],
theme: {
extend: {
colors: {
brand: { 50: '#eff6ff', 500: '#3b82f6', 900: '#1e3a8a' },
surface: 'hsl(var(--surface))', // CSS var = dark mode 쉬움
},
borderRadius: { sm: '4px', md: '8px', lg: '16px' },
fontFamily: { sans: ['Inter', 'system-ui'] },
spacing: { 18: '4.5rem' },
},
},
plugins: [require('@tailwindcss/forms')],
} satisfies Config;
v4 — CSS-first
/* app.css */
@import "tailwindcss";
@theme {
--color-brand-500: #3b82f6;
--radius-md: 8px;
--font-sans: Inter, system-ui;
}
Component with cva
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '@/lib/cn';
const button = cva(
'inline-flex items-center justify-center rounded-md font-medium transition focus-visible:ring-2',
{
variants: {
variant: {
primary: 'bg-brand-500 text-white hover:bg-brand-600',
secondary: 'bg-surface text-foreground hover:bg-muted',
ghost: 'hover:bg-muted',
},
size: {
sm: 'h-8 px-3 text-sm',
md: 'h-10 px-4',
lg: 'h-12 px-6 text-lg',
},
fullWidth: { true: 'w-full' },
},
defaultVariants: { variant: 'primary', size: 'md' },
}
);
type Props = React.ButtonHTMLAttributes<HTMLButtonElement> & VariantProps<typeof button>;
export function Button({ className, variant, size, fullWidth, ...rest }: Props) {
return <button className={cn(button({ variant, size, fullWidth }), className)} {...rest} />;
}
cn helper
import { type ClassValue, clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
export function cn(...args: ClassValue[]) { return twMerge(clsx(args)); }
Dark mode (CSS var)
/* root */
:root {
--surface: 0 0% 100%;
--foreground: 222 47% 11%;
}
.dark {
--surface: 222 47% 11%;
--foreground: 0 0% 100%;
}
// theme.ts
colors: {
surface: 'hsl(var(--surface) / <alpha-value>)',
foreground: 'hsl(var(--foreground) / <alpha-value>)',
}
Repsonsive + state
<div className="text-sm md:text-base hover:bg-muted dark:hover:bg-muted/50">
Plugin (custom utility)
// tailwind.config.ts
plugins: [
plugin(({ addUtilities }) => {
addUtilities({
'.no-scrollbar::-webkit-scrollbar': { display: 'none' },
'.no-scrollbar': { 'scrollbar-width': 'none' },
});
}),
],
🤔 의사결정 기준
| 상황 | 패턴 |
|---|---|
| 작은 1회용 | inline className |
| 반복 변형 (button, badge) | cva component |
| 디자인 토큰 통일 | theme.extend |
| 다크 모드 | CSS var + class strategy |
| 외부 라이브러리 (Radix) | data-* selector + Tailwind |
| 거대 제품 디자인 시스템 | shadcn/ui + cva |
❌ 안티패턴
className="text-red-500 bg-blue-200 ..."30개: 컴포넌트 추출.- 인라인 magic value (
mt-[17px]): 토큰화 또는 spacing extend. - JIT 안 적용 path: content 에 모든 src 포함.
!important(!text-red) 남발: cn + variant 우선순위로.- dark mode 매 클래스 dark:`: CSS var 가 깨끗.
- theme 색 random:
red-500,red-600,red-700정해진 stops 만. - cva 없이 거대 ternary: 가독성 0.
🤖 LLM 활용 힌트
- cva + cn + tw-merge 3종.
- theme.extend = design token.
- shadcn/ui 가 좋은 reference.