File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
apps/studio/electron/main/assets Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -141,9 +141,16 @@ async function createTailwindColorVariable(
141
141
142
142
const newCssVarName = parentName ?. length ? `${ parentName } -${ camelCaseName } ` : camelCaseName ;
143
143
144
- // Update CSS file
145
- const updatedCssContent = await addTailwindCssVariable ( cssContent , newCssVarName , newColor ) ;
146
- fs . writeFileSync ( cssPath , updatedCssContent ) ;
144
+ // Check if CSS variable already exists
145
+ const cssVariables = extractTailwindCssVariables ( cssContent ) ;
146
+
147
+ if ( cssVariables . root [ newCssVarName ] || cssVariables . dark [ newCssVarName ] ) {
148
+ return { success : false , error : `CSS variable --${ newCssVarName } already exists` } ;
149
+ } else {
150
+ // Variable doesn't exist, add it
151
+ const updatedCssContent = await addTailwindCssVariable ( cssContent , newCssVarName , newColor ) ;
152
+ fs . writeFileSync ( cssPath , updatedCssContent ) ;
153
+ }
147
154
148
155
// Update config file
149
156
const updateAst = parse ( configContent , {
You can’t perform that action at this time.
0 commit comments