Skip to content

Commit 86be8ea

Browse files
committed
Don't add more empty lines than needed
1 parent f5f7e14 commit 86be8ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ module.exports = postcss.plugin('postcss-sorting', function (opts) {
316316
countEmptyLines(applicableNode.raws.before) < linesBetweenChildrenRules
317317
)
318318
) {
319-
applicableNode.raws.before = createLineBreaks(linesBetweenChildrenRules) + applicableNode.raws.before;
319+
applicableNode.raws.before = createLineBreaks(linesBetweenChildrenRules - countEmptyLines(applicableNode.raws.before)) + applicableNode.raws.before;
320320
}
321321
}
322322
}
@@ -327,7 +327,7 @@ module.exports = postcss.plugin('postcss-sorting', function (opts) {
327327
applicableNode = getApplicableNode('atrule', node);
328328

329329
if (applicableNode) {
330-
applicableNode.raws.before = createLineBreaks(linesBetweenMediaRules) + applicableNode.raws.before;
330+
applicableNode.raws.before = createLineBreaks(linesBetweenMediaRules - countEmptyLines(applicableNode.raws.before)) + applicableNode.raws.before;
331331
}
332332
}
333333
}

0 commit comments

Comments
 (0)