parent
18072c4887
commit
fa3790e618
|
@ -16,7 +16,8 @@ import {
|
||||||
STYLE_EXP,
|
STYLE_EXP,
|
||||||
HTML_EXP,
|
HTML_EXP,
|
||||||
CSS_SHEET_EXP,
|
CSS_SHEET_EXP,
|
||||||
HMR_SCRIPT
|
HMR_SCRIPT,
|
||||||
|
V_DEEP
|
||||||
} from './constants.js'
|
} from './constants.js'
|
||||||
|
|
||||||
const OPTIONS = {
|
const OPTIONS = {
|
||||||
|
@ -45,7 +46,18 @@ function scopeCss(css = '', hash) {
|
||||||
let tmp = s.split(' ')
|
let tmp = s.split(' ')
|
||||||
let last = tmp.pop()
|
let last = tmp.pop()
|
||||||
if (last.includes(':')) {
|
if (last.includes(':')) {
|
||||||
|
let res = V_DEEP.exec(last)
|
||||||
|
if (res) {
|
||||||
|
last = tmp.pop()
|
||||||
|
last += `[data-${hash}] ` + res[1]
|
||||||
|
} else {
|
||||||
|
if (last.startsWith(':')) {
|
||||||
|
let _prev = tmp.pop()
|
||||||
|
last = `${_prev}[data-${hash}] ` + last
|
||||||
|
} else {
|
||||||
last = last.replace(':', `[data-${hash}]:`)
|
last = last.replace(':', `[data-${hash}]:`)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
last += `[data-${hash}]`
|
last += `[data-${hash}]`
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
export const JS_EXP = /<script[^>]*?>([\w\W]*?)<\/script>/
|
export const JS_EXP = /<script[^>]*?>([\w\W]*?)<\/script>/
|
||||||
export const STYLE_EXP = /<style([^>]*?)>([\w\W]*?)<\/style>/g
|
export const STYLE_EXP = /<style([^>]*?)>([\w\W]*?)<\/style>/g
|
||||||
export const HTML_EXP = /<template[^>]*?>([\w\W]*?)\n<\/template>/
|
export const HTML_EXP = /<template[^>]*?>([\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
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "fite",
|
"name": "fite",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.4.0",
|
"version": "0.5.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"fite": "index.js"
|
"fite": "index.js"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue