|
|
|
|
@ -126,9 +126,7 @@ const visitors = {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const used = node.prelude.children.filter((s) => s.metadata.used);
|
|
|
|
|
|
|
|
|
|
if (used.length === 0) {
|
|
|
|
|
if (!node.prelude.children.some((s) => s.metadata.used)) {
|
|
|
|
|
state.code.prependRight(node.start, '/* (unused) ');
|
|
|
|
|
state.code.appendLeft(node.end, '*/');
|
|
|
|
|
escape_comment_close(node, state.code);
|
|
|
|
|
@ -139,9 +137,6 @@ const visitors = {
|
|
|
|
|
next();
|
|
|
|
|
},
|
|
|
|
|
SelectorList(node, { state, next, path }) {
|
|
|
|
|
const used = node.children.filter((s) => s.metadata.used);
|
|
|
|
|
|
|
|
|
|
if (used.length < node.children.length) {
|
|
|
|
|
let pruning = false;
|
|
|
|
|
let last = node.children[0].start;
|
|
|
|
|
|
|
|
|
|
@ -171,13 +166,9 @@ const visitors = {
|
|
|
|
|
if (pruning) {
|
|
|
|
|
state.code.appendLeft(last, '*/');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const parent = /** @type {import('#compiler').Css.Node} */ (path.at(-1));
|
|
|
|
|
next({
|
|
|
|
|
...state,
|
|
|
|
|
specificity: parent.type === 'Rule' ? { bumped: false } : state.specificity
|
|
|
|
|
});
|
|
|
|
|
const specificity = path.at(-1)?.type === 'Rule' ? { bumped: false } : state.specificity;
|
|
|
|
|
next({ ...state, specificity });
|
|
|
|
|
},
|
|
|
|
|
ComplexSelector(node, context) {
|
|
|
|
|
/** @param {import('#compiler').Css.SimpleSelector} selector */
|
|
|
|
|
|