fix: pseudo styles being removed with postcssIsolateStyles

closes #2868
closes #2867
pull/2876/head
Divyansh Singh 1 year ago
parent 6be5a7e830
commit 21b4f8caad

@ -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

Loading…
Cancel
Save