Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitee9393d

Browse files
committed
fix(cli): prevent duplicate keyframes when adding components
from shadcn
1 parent0b373b9 commitee9393d

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

‎packages/cli/src/utils/updaters/update-css.ts‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,33 @@ function updateCssPlugin(css: z.infer<typeof registryItemCssSchema>) {
268268
)
269269
}
270270

271-
constkeyframesRule=postcss.atRule({
272-
name:'keyframes',
273-
params,
274-
raws:{semicolon:true,between:' ',before:'\n '},
275-
})
271+
// Check if a keyframe with the same name already exists
272+
constexistingKeyframesRule=themeInline.nodes?.find(
273+
(node):node isAtRule=>
274+
node.type==='atrule'
275+
&&node.name==='keyframes'
276+
&&node.params===params,
277+
)
276278

277-
themeInline.append(keyframesRule)
279+
letkeyframesRule:AtRule
280+
if(existingKeyframesRule){
281+
// Replace existing keyframe
282+
keyframesRule=postcss.atRule({
283+
name:'keyframes',
284+
params,
285+
raws:{semicolon:true,between:' ',before:'\n '},
286+
})
287+
existingKeyframesRule.replaceWith(keyframesRule)
288+
}
289+
else{
290+
// Create new keyframe
291+
keyframesRule=postcss.atRule({
292+
name:'keyframes',
293+
params,
294+
raws:{semicolon:true,between:' ',before:'\n '},
295+
})
296+
themeInline.append(keyframesRule)
297+
}
278298

279299
if(typeofproperties==='object'){
280300
for(const[step,stepProps]ofObject.entries(properties)){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp