From e36f55bde2428aa2044d4da8849827385ff481ae Mon Sep 17 00:00:00 2001 From: Antonio Developer <135407839+Anton-dev3306@users.noreply.github.com> Date: Sun, 3 May 2026 13:53:42 -0600 Subject: [PATCH] fix: restore indent level after LESS each() mixin #2380 --- js/src/css/beautifier.js | 1 + python/cssbeautifier/css/beautifier.py | 1 + test/data/css/tests.js | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/js/src/css/beautifier.js b/js/src/css/beautifier.js index 5c0e393f5..6782516a2 100644 --- a/js/src/css/beautifier.js +++ b/js/src/css/beautifier.js @@ -377,6 +377,7 @@ Beautifier.prototype.beautify = function() { } if (this._input.peek() === ')') { this._output.trim(true); + this.indent(); if (this._options.brace_style === "expand") { this._output.add_new_line(true); } diff --git a/python/cssbeautifier/css/beautifier.py b/python/cssbeautifier/css/beautifier.py index 76cd4e27a..d093bead0 100644 --- a/python/cssbeautifier/css/beautifier.py +++ b/python/cssbeautifier/css/beautifier.py @@ -394,6 +394,7 @@ def beautify(self): self._output.add_new_line(True) if self._input.peek() == ")": self._output.trim(True) + self.indent() if self._options.brace_style == "expand": self._output.add_new_line(True) elif self._ch == ":": diff --git a/test/data/css/tests.js b/test/data/css/tests.js index ce5965d1c..5a1d74c8e 100644 --- a/test/data/css/tests.js +++ b/test/data/css/tests.js @@ -1978,6 +1978,18 @@ exports.test_data = { ' border: @border-width solid @color;', '}' ] + }, { + comment: 'Issue #2380 - each() mixin should not break indentation of subsequent rules', + unchanged: [ + '.my-function(@iterator) {', + ' each(@iterator, {', + ' color: red;', + ' });', + ' .correct-indentation {', + ' color: blue;', + ' }', + '}' + ] }] }, { name: "Preserve Newlines and max number of new lines",