8000 chore(compiler-sfc): match `@keyframes` exactly by KazariEX · Pull Request #13566 · vuejs/core · GitHub
[go: up one dir, main page]

Skip to content

chore(compiler-sfc): match @keyframes exactly #13566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(compiler-sfc): match @keyframes exactly
  • Loading branch information
KazariEX committed Jul 4, 2025
commit 72077afcd0c51819f24587d3c728e2984b4a463c
8 changes: 3 additions & 5 deletions packages/compiler-sfc/src/style/pluginScoped.ts
9F55
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { warn } from '../warn'

const animationNameRE = /^(-\w+-)?animation-name$/
const animationRE = /^(-\w+-)?animation$/
const keyframesRE = /^(?:-\w+-)?keyframes$/

const scopedPlugin: PluginCreator<string> = (id = '') => {
const keyframes = Object.create(null)
Expand All @@ -21,10 +22,7 @@ const scopedPlugin: PluginCreator<string> = (id = '') => {
processRule(id, rule)
},
AtRule(node) {
if (
/-?keyframes$/.test(node.name) &&
!node.params.endsWith(`-${shortId}`)
) {
if (keyframesRE.test(node.name) && !node.params.endsWith(`-${shortId}`)) {
// register keyframes
keyframes[node.params] = node.params = node.params + '-' + shortId
}
Expand Down Expand Up @@ -72,7 +70,7 @@ function processRule(id: string, rule: Rule) {
processedRules.has(rule) ||
(rule.parent &&
rule.parent.type === 'atrule' &&
/-?keyframes$/.test((rule.parent as AtRule).name))
keyframesRE.test((rule.parent as AtRule).name))
) {
return
}
Expand Down
0