|
|
|
@ -1,17 +1,13 @@
|
|
|
|
|
import postcssPrefixSelector from 'postcss-prefix-selector'
|
|
|
|
|
|
|
|
|
|
type Options = Parameters<typeof postcssPrefixSelector>[0] & {
|
|
|
|
|
enable?: boolean
|
|
|
|
|
}
|
|
|
|
|
type Options = Parameters<typeof postcssPrefixSelector>[0]
|
|
|
|
|
|
|
|
|
|
export function postcssIsolateStyles(_options: Options = {}) {
|
|
|
|
|
const { enable, ...options } = _options
|
|
|
|
|
if (enable === false) return false
|
|
|
|
|
export function postcssIsolateStyles(options: Options = {}) {
|
|
|
|
|
return postcssPrefixSelector({
|
|
|
|
|
prefix: ':not(:where(.vp-raw, .vp-raw *))',
|
|
|
|
|
includeFiles: [/base\.css/],
|
|
|
|
|
transform(prefix, _selector) {
|
|
|
|
|
const [selector, pseudo = ''] = _selector.split(/:\S*$/)
|
|
|
|
|
const [selector, pseudo = ''] = _selector.split(/(:\S*)$/)
|
|
|
|
|
return selector + prefix + pseudo
|
|
|
|
|
},
|
|
|
|
|
...options
|
|
|
|
|