Skip to content

Commit

Permalink
Compressed style: Fix space removal after ancestor
Browse files Browse the repository at this point in the history
    echo '.foo .bar{top:0}' | sassc/bin/sassc -t compressed

Before: `.foo.bar{top:0}`
After:  `.foo .bar{top:0}`

Fixes sass#2988
  • Loading branch information
glebm committed Sep 16, 2019
1 parent 0488cee commit 9932747
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/inspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,14 +1054,21 @@ namespace Sass {
}
void Inspect::operator()(ComplexSelector* sel)
{
bool many = false;
if (sel->hasPreLineFeed()) {
append_optional_linefeed();
}
const SelectorComponent* prev = nullptr;
for (auto& item : sel->elements()) {
if (many) append_optional_space();
if (prev != nullptr) {
if (typeid(*item) == typeid(SelectorCombinator) ||
typeid(*prev) == typeid(SelectorCombinator)) {
append_optional_space();
} else {
append_mandatory_space();
}
}
item->perform(this);
many = true;
prev = item.ptr();
}
}

Expand Down

0 comments on commit 9932747

Please sign in to comment.