diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/csso/lib/clean/Atrule.js | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/csso/lib/clean/Atrule.js')
| -rw-r--r-- | node_modules/csso/lib/clean/Atrule.js | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/node_modules/csso/lib/clean/Atrule.js b/node_modules/csso/lib/clean/Atrule.js deleted file mode 100644 index 236d122d..00000000 --- a/node_modules/csso/lib/clean/Atrule.js +++ /dev/null @@ -1,69 +0,0 @@ -import { keyword as resolveKeyword } from 'css-tree'; -import { hasNoChildren } from './utils.js'; - -export default function cleanAtrule(node, item, list) { - if (node.block) { - // otherwise removed at-rule don't prevent @import for removal - if (this.stylesheet !== null) { - this.stylesheet.firstAtrulesAllowed = false; - } - - if (hasNoChildren(node.block)) { - list.remove(item); - return; - } - } - - switch (node.name) { - case 'charset': - if (hasNoChildren(node.prelude)) { - list.remove(item); - return; - } - - // if there is any rule before @charset -> remove it - if (item.prev) { - list.remove(item); - return; - } - - break; - - case 'import': - if (this.stylesheet === null || !this.stylesheet.firstAtrulesAllowed) { - list.remove(item); - return; - } - - // if there are some rules that not an @import or @charset before @import - // remove it - list.prevUntil(item.prev, function(rule) { - if (rule.type === 'Atrule') { - if (rule.name === 'import' || rule.name === 'charset') { - return; - } - } - - this.root.firstAtrulesAllowed = false; - list.remove(item); - - return true; - }, this); - - break; - - default: { - const name = resolveKeyword(node.name).basename; - - if (name === 'keyframes' || - name === 'media' || - name === 'supports') { - - // drop at-rule with no prelude - if (hasNoChildren(node.prelude) || hasNoChildren(node.block)) { - list.remove(item); - } - } - } - } -}; |
