From a0f06b01716e5c983ccc18109d1649c4007bdc2b Mon Sep 17 00:00:00 2001 From: yutent Date: Wed, 26 Apr 2023 15:10:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=A0=B7=E5=BC=8F=E9=85=8D?= =?UTF-8?q?=E7=BD=AEscoped=E6=97=B6,=20=E8=AF=AF=E4=BC=A4keyframes?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/compile-vue.js | 7 ++++++- lib/constants.js | 3 ++- package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/compile-vue.js b/lib/compile-vue.js index 6e39619..13f6269 100644 --- a/lib/compile-vue.js +++ b/lib/compile-vue.js @@ -17,7 +17,8 @@ import { HTML_EXP, CSS_SHEET_EXP, HMR_SCRIPT, - V_DEEP + V_DEEP, + PERCENT_EXP } from './constants.js' const OPTIONS = { @@ -43,6 +44,10 @@ function scopeCss(css = '', hash) { selector = selector .map(s => { + // 针对 @keyframe的处理 + if (s === 'from' || s === 'to' || PERCENT_EXP.test(s)) { + return s + } let tmp = s.split(' ') let last = tmp.pop() if (last.includes(':')) { diff --git a/lib/constants.js b/lib/constants.js index 770bb1d..1fed485 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -9,7 +9,8 @@ export const STYLE_EXP = /]*?)>([\w\W]*?)<\/style>/g export const HTML_EXP = /]*?>([\w\W]*?)\n<\/template>/ export const V_DEEP = /:deep\(([^)]*?)\)/ -export const CSS_SHEET_EXP = /([@\w\.,#\-:>\+\~\|\(\)\[\]"'\=\s]+)\{/g +export const CSS_SHEET_EXP = /([%@\w\.,#\-:>\+\~\|\(\)\[\]"'\=\s]+)\{/g +export const PERCENT_EXP = /^\d+%$/ export const COMMON_HEADERS = { 'Cache-Control': 'no-store' diff --git a/package.json b/package.json index c5316a6..44221f6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "fite", "type": "module", - "version": "0.7.0", + "version": "0.7.1", "bin": { "fite": "index.js" },