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" },