Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions scss.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ function compile($code, $name=null) {

$this->compileRoot($tree);

ob_start();
$this->formatter->block($this->scope);
$out = ob_get_clean();
$out = $this->formatter->format($this->scope);

setlocale(LC_NUMERIC, $locale);
return $out;
Expand Down Expand Up @@ -3852,7 +3850,7 @@ public function property($name, $value) {
return $name . $this->assignSeparator . $value . ";";
}

public function block($block) {
protected function block($block) {
if (empty($block->lines) && empty($block->children)) return;

$inner = $pre = $this->indentStr();
Expand Down Expand Up @@ -3883,6 +3881,14 @@ public function block($block) {
echo $pre . $this->close . $this->break;
}
}

public function format($block) {
ob_start();
$this->block($block);
$out = ob_get_clean();

return $out;
}
}

/**
Expand Down Expand Up @@ -3930,7 +3936,7 @@ public function adjustAllChildren($block) {
}
}

public function block($block) {
protected function block($block) {
if ($block->type == "root") {
$this->adjustAllChildren($block);
}
Expand Down Expand Up @@ -3990,6 +3996,10 @@ class scss_formatter_compressed extends scss_formatter {
public function indentStr($n = 0) {
return "";
}

public function format($block) {
return preg_replace('@/\*.*?\*/@s', '', parent::format($block));
}
}

/**
Expand Down