mirror of
https://codeberg.org/Kankys/NewLukasBlog.git
synced 2026-11-11 14:14:36 +01:00
OpravyPoAI
This commit is contained in:
1 parent
99aa797101
commit
24fd53c94c
4746 files changed
+700320
-12
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
import { List } from 'css-tree';
|
||||
|
||||
export default function compressBackground(node) {
|
||||
function flush() {
|
||||
if (!buffer.length) {
|
||||
buffer.unshift(
|
||||
{
|
||||
type: 'Number',
|
||||
loc: null,
|
||||
value: '0'
|
||||
},
|
||||
{
|
||||
type: 'Number',
|
||||
loc: null,
|
||||
value: '0'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
newValue.push.apply(newValue, buffer);
|
||||
|
||||
buffer = [];
|
||||
}
|
||||
|
||||
let newValue = [];
|
||||
let buffer = [];
|
||||
|
||||
node.children.forEach((node) => {
|
||||
if (node.type === 'Operator' && node.value === ',') {
|
||||
flush();
|
||||
newValue.push(node);
|
||||
return;
|
||||
}
|
||||
|
||||
// remove defaults
|
||||
if (node.type === 'Identifier') {
|
||||
if (node.name === 'transparent' ||
|
||||
node.name === 'none' ||
|
||||
node.name === 'repeat' ||
|
||||
node.name === 'scroll') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
buffer.push(node);
|
||||
});
|
||||
|
||||
flush();
|
||||
node.children = new List().fromArray(newValue);
|
||||
};
|
||||
Reference in new issue
Block a user