Patterns for analyzing HTML/CSS mocks from Stitch, Figma, or similar tools. Covers section identification, component detection, and Tailwind config extraction. Use this skill when parsing mocks for block conversion.
Patterns for parsing and analyzing HTML/CSS mocks to prepare for block conversion.
Standard export structure (flexible detection):
mock-folder/
├── code.html # Main HTML markup (or *.html)
├── screen.png # Visual screenshot (or *.png, *.jpg)
├── assets/ # Images, fonts (optional)
│ ├── images/
│ └── fonts/
└── tailwind.config.js # Sometimes included inline in HTML
Flexible File Detection:
| File Type | Detection Pattern |
|---|
| Required |
|---|
| HTML | code.html, index.html, *.html | Recommended |
| Screenshot | screen.png, *.png, *.jpg, *.jpeg | Required |
| Tailwind Config | tailwind.config.js, inline in HTML | Optional |
| Assets | assets/, images/ | Optional |
*.pdf (for Figma exports) | Alternative |
Detection Priority:
code.html → Primary HTML fileindex.html → Alternative name*.html → Fallbackscreen.png → Primary screenshotscreenshot.png, screen.jpg → Alternatives*.png, *.jpg → FallbackWorkflow Integration:
mocks/ folder<!-- Indicators -->
<section class="...min-h-[500px]..."> <!-- Large min-height -->
<section class="...h-screen..."> <!-- Full viewport -->
<div class="...bg-cover..."> <!-- Background image -->
<h1>...</h1> <!-- Main heading -->
Classification: type: "hero"
<header>...</header>
<nav>...</nav>
<div class="...fixed...top-0...">
Classification: type: "navigation"
<div class="...grid...grid-cols-3...">
<div>...</div> <!-- Repeated pattern -->
<div>...</div>
<div>...</div>
</div>
Classification: type: "features"
<section class="...text-center...py-16...">
<h2>...</h2>
<p>...</p>
<button>...</button> <!-- 1-2 buttons -->
</section>
Classification: type: "cta"
<footer>...</footer>
<div class="...mt-auto..."> <!-- At bottom -->
Classification: type: "footer"
<button class="...">Text</button>
<a href="..." class="...btn...">Text</a>
<a href="..." class="...rounded...bg-...">Text</a>
<form>...</form>
<input type="...">
<div class="...flex...gap-...">
<input>
<button>Submit</button>
</div>
<div class="...rounded...border...shadow...">
<img>
<h3>...</h3>
<p>...</p>
</div>
<svg>...</svg>
<i class="...icon...">
<span class="...lucide-...">
Look for inline config in HTML:
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: '#137fec',
'background-dark': '#101922',
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
}
}
}
}
</script>
Extract:
colors → For ds-mappingfontFamily → For typography mappingspacing → If customizedborderRadius → If customized{
"mockPath": "_tmp/mocks/stitch/landing-page",
"htmlFile": "code.html",
"screenshotFile": "screen.png",
"analyzedAt": "2025-01-09T12:00:00Z",
"tailwindConfig": {
"found": true,
"colors": {
"primary": "#137fec",
"background-dark": "#101922",
"accent": "#00d4ff"
},
"fonts": {
"sans": ["Inter", "sans-serif"],
"mono": ["JetBrains Mono", "monospace"]
}
},
"sections": [
{
"id": "section-1",
"type": "hero",
"selector": "section:first-of-type",
"htmlSnippet": "<section class=\"relative min-h-[600px]...\">",
"components": [
{"type": "heading", "level": 1, "text": "Build faster..."},
{"type": "paragraph", "text": "The complete..."},
{"type": "button", "text": "Get Started", "variant": "primary"},
{"type": "custom", "name": "terminal-animation"}
],
"layout": {
"type": "centered-flex",
"minHeight": "600px",
"hasBackground": true,
"backgroundType": "gradient"
},
"estimatedComplexity": "high",
"notes": "Contains animated terminal component"
},
{
"id": "section-2",
"type": "features",
"selector": "section:nth-of-type(2)",
"components": [
{"type": "heading", "level": 2},
{"type": "grid", "columns": 3, "items": 6}
],
"layout": {
"type": "grid",
"columns": "3",
"gap": "6"
},
"estimatedComplexity": "low"
}
],
"componentInventory": {
"headings": {"h1": 1, "h2": 4, "h3": 12},
"buttons": 8,
"links": 24,
"images": 6,
"icons": 18,
"forms": 1,
"customComponents": [
{"name": "terminal-animation", "section": "section-1"},
{"name": "tabs-preview", "section": "section-4"},
{"name": "chat-widget", "section": "section-5"}
]
},
"summary": {
"totalSections": 7,
"complexity": "medium-high",
"customComponentsCount": 3,
"estimatedBlocks": {
"new": 3,
"existing": 4
}
}
}
design-system - For token mapping after analysispage-builder-blocks - For understanding target block structureshadcn-components - For component pattern matching