Skip to main content
Home/Recipes/Legacy CSS to design tokens
Code & Tokens

34.Legacy CSS to design tokens

DeveloperEnterprise

Overview

Extract the current live site to capture what actually shipped. Use that as ground truth to generate CSS custom properties and replace scattered hardcoded values across the codebase.

Legacy CSS codebases typically have no token system: colors are hardcoded in hundreds of places, spacing is arbitrary, and there is no single source of truth for any visual property. Extract the live site to capture the actual token values that shipped, then use that as ground truth to generate a CSS custom properties file (:root { ... }) and systematically replace hardcoded values across the codebase with var() references. This migration can be done incrementally: generate the token file first, then refactor one component or file at a time.

Extract live site

Terminal
dembrandt app.company.com --crawl 5 --save-output
Claude Code prompt
# With extraction JSON and existing CSS in context:
"Generate a CSS custom properties file (:root { ... }) from
these extracted tokens. Then audit the existing CSS and
replace hardcoded values with the correct var() references."
Output

CSS custom properties file + refactored stylesheets using var() references.

Browse all

All recipes →

43 workflows