MCPcopy Create free account
hub / github.com/bernaferrari/FigmaToCode / stylesToCSS

Function stylesToCSS

packages/backend/src/html/htmlMain.ts:80–100  ·  view source on GitHub ↗
(styles: string[], isJSX: boolean)

Source from the content-addressed store, hash-verified

78
79// Convert styles to CSS format
80export function stylesToCSS(styles: string[], isJSX: boolean): string[] {
81 return styles
82 .map((style) => {
83 // Skip empty styles
84 if (!style.trim()) return "";
85
86 // Handle JSX format if needed
87 if (isJSX) {
88 return style.replace(/^([a-zA-Z0-9]+):/, (match, prop) => {
89 // Convert camelCase to kebab-case for CSS
90 return (
91 prop
92 .replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2")
93 .toLowerCase() + ":"
94 );
95 });
96 }
97 return style;
98 })
99 .filter(Boolean); // Remove empty entries
100}
101
102// Get proper component name from node info
103export function getComponentName(

Callers 2

getTextSegmentsMethod · 0.90
storeStylesMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected