Skip to content

Commit 5c267e1

Browse files
committed
Preserve indentation for media rules in nested mode
1 parent 0790fc8 commit 5c267e1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/inspect.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ namespace Sass {
7272
append_indentation();
7373
append_token("@media", rule);
7474
append_mandatory_space();
75-
in_media_block = true;
76-
in_media_block = false;
7775
if (rule->block()) {
7876
rule->block()->perform(this);
7977
}
8078
}
8179

8280
void Inspect::operator()(CssMediaRule* rule)
8381
{
82+
if (output_style() == NESTED)
83+
indentation += rule->tabs();
8484
append_indentation();
8585
append_token("@media", rule);
8686
append_mandatory_space();
@@ -97,6 +97,9 @@ namespace Sass {
9797
if (rule->block()) {
9898
rule->block()->perform(this);
9999
}
100+
in_media_block = false;
101+
if (output_style() == NESTED)
102+
indentation -= rule->tabs();
100103
}
101104

102105
void Inspect::operator()(CssMediaQuery* query)
@@ -1056,7 +1059,7 @@ namespace Sass {
10561059
{
10571060
if (sel->hasPreLineFeed()) {
10581061
append_optional_linefeed();
1059-
if (output_style() == NESTED) {
1062+
if (!in_wrapped && output_style() == NESTED) {
10601063
append_indentation();
10611064
}
10621065
}

0 commit comments

Comments
 (0)