Example:
"use strict";
const postcss = require("postcss");
const css = ":root { --foo: { color: red };; --bar: { color: blue }; --bar-foo: { color: red }; }";
console.log(postcss.parse(css).toString());
Output (no extra semicolon after --foo):
:root { --foo: { color: red }; --bar: { color: blue }; --bar-foo: { color: red }; }
Seems (:root { --foo: { color: red };; --bar: { color: blue }; --bar-foo: { color: red }; }) --bar node doesn't contain this extra semicolon in raws.before:
Rule {
raws:
{ before: ' ',
between: ' ',
semicolon: false,
after: ' ',
ownSemicolon: ';' },
type: 'rule',
nodes:
[ Declaration {
raws: [Object],
type: 'decl',
parent: [Circular],
source: [Object],
prop: 'color',
value: 'blue' } ],
parent:
Rule {
raws: { before: '', between: ' ', semicolon: false, after: ' ' },
type: 'rule',
nodes: [ [Object], [Circular], [Object] ],
parent:
Root {
raws: [Object],
type: 'root',
nodes: [Object],
source: [Object],
lastEach: 4,
indexes: [Object] },
source: { start: [Object], input: [Object], end: [Object] },
selector: ':root',
lastEach: 4,
indexes: { '4': 1 } },
source:
{ start: { line: 1, column: 33 },
input:
Input {
css: ':root { --foo: { color: red };; --bar: { color: blue }; --bar-foo: { color: red }; }',
id: '<input css 1>' },
end: { line: 1, column: 54 } },
selector: '--bar:',
lastEach: 3,
indexes: {} }
Also a { color: red; };; after stringify lose semicolon a { color: red; }; (seems it is related to Rule)
Fixed 771724c
Released in 6.0.4
Most helpful comment
Fixed 771724c