|
|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
import MagicString, { OverwriteOptions } from 'magic-string';
|
|
|
|
|
import generate from 'css-tree/lib/generator/index.js';
|
|
|
|
|
import { walk } from 'estree-walker';
|
|
|
|
|
import Selector from './Selector';
|
|
|
|
|
import Element from '../nodes/Element';
|
|
|
|
|
@ -528,18 +527,20 @@ export default class Stylesheet {
|
|
|
|
|
walk(this.ast.css.children as any, {
|
|
|
|
|
enter: (node: any, parent: any) => {
|
|
|
|
|
if (node.children && node.type === 'Value') {
|
|
|
|
|
const abc = generate(parent);
|
|
|
|
|
console.log(abc);
|
|
|
|
|
let c = node.start;
|
|
|
|
|
node.children.forEach((child: any, i: number) => {
|
|
|
|
|
if (child.type !== 'WhiteSpace') {
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
if (child.type === 'Operator') {
|
|
|
|
|
if (child.type === 'WhiteSpace') {
|
|
|
|
|
!format && c++;
|
|
|
|
|
} else if (child.type === 'Operator') {
|
|
|
|
|
code.remove(c, child.start);
|
|
|
|
|
c = child.end;
|
|
|
|
|
} else {
|
|
|
|
|
overwrite(code, c, child.start, format ? ' ' : '');
|
|
|
|
|
}
|
|
|
|
|
format && overwrite(code, c, child.start, ' ');
|
|
|
|
|
!format && code.remove(c, child.start);
|
|
|
|
|
c = child.end;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
c = child.end;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|