新增: - backend/venv/ - Python 虚拟环境 - backend/start.sh - 启动脚本(使用虚拟环境) - backend/requirements.txt - 依赖列表 - .gitignore - 忽略虚拟环境和缓存文件 说明: - 每个项目使用独立虚拟环境 - 避免依赖冲突 - 启动脚本自动创建和激活虚拟环境
27 lines
774 B
JavaScript
27 lines
774 B
JavaScript
import parser from 'postcss-selector-parser'
|
|
import { movePseudos } from './pseudoElements'
|
|
|
|
export function applyImportantSelector(selector, important) {
|
|
let sel = parser().astSync(selector)
|
|
|
|
sel.each((sel) => {
|
|
// For nesting, we only need to wrap a selector with :is() if it has a top-level combinator,
|
|
// e.g. `.dark .text-white`, to be independent of DOM order. Any other selector, including
|
|
// combinators inside of pseudos like `:where()`, are ok to nest.
|
|
let shouldWrap = sel.nodes.some((node) => node.type === 'combinator')
|
|
|
|
if (shouldWrap) {
|
|
sel.nodes = [
|
|
parser.pseudo({
|
|
value: ':is',
|
|
nodes: [sel.clone()],
|
|
}),
|
|
]
|
|
}
|
|
|
|
movePseudos(sel)
|
|
})
|
|
|
|
return `${important} ${sel.toString()}`
|
|
}
|