* Normalize spaces in cascade declaration group
(decl)
| 575 | * Normalize spaces in cascade declaration group |
| 576 | */ |
| 577 | reduceSpaces(decl) { |
| 578 | let stop = false |
| 579 | this.prefixes.group(decl).up(() => { |
| 580 | stop = true |
| 581 | return true |
| 582 | }) |
| 583 | if (stop) { |
| 584 | return |
| 585 | } |
| 586 | |
| 587 | let parts = decl.raw('before').split('\n') |
| 588 | let prevMin = parts[parts.length - 1].length |
| 589 | /** @type {number|false} */ |
| 590 | let diff = false |
| 591 | |
| 592 | this.prefixes.group(decl).down(other => { |
| 593 | parts = other.raw('before').split('\n') |
| 594 | let last = parts.length - 1 |
| 595 | |
| 596 | if (parts[last].length > prevMin) { |
| 597 | if (diff === false) { |
| 598 | diff = parts[last].length - prevMin |
| 599 | } |
| 600 | |
| 601 | parts[last] = parts[last].slice(0, -diff) |
| 602 | other.raws.before = parts.join('\n') |
| 603 | } |
| 604 | }) |
| 605 | } |
| 606 | |
| 607 | /** |
| 608 | * Remove unnecessary pefixes |