You are here

protected function SassCompactRenderer::renderDebug in Sassy 7.3

Same name and namespace in other branches
  1. 7 phamlp/sass/renderers/SassCompactRenderer.php \SassCompactRenderer::renderDebug()

Renders debug information. If the node has the debug_info options set true the line number and filename are rendered in a format compatible with {@link https://addons.mozilla.org/en-US/firefox/addon/103988/ FireSass}. Else if the node has the line_numbers option set true the line number and filename are rendered in a comment.

Parameters

SassNode the node being rendered:

Return value

string the debug information

1 call to SassCompactRenderer::renderDebug()
SassCompactRenderer::renderRule in phpsass/renderers/SassCompactRenderer.php
Renders a rule.

File

phpsass/renderers/SassCompactRenderer.php, line 106

Class

SassCompactRenderer
SassCompactRenderer class. Each CSS rule takes up only one line, with every property defined on that line. Nested rules are placed next to each other with no newline, while groups of rules have newlines between them. @package PHamlP @subpackage …

Code

protected function renderDebug($node) {
  $indent = $this
    ->getIndent($node);
  $debug = '';
  if ($node->debug_info) {
    $debug = $indent . self::DEBUG_INFO_RULE . '{';
    $debug .= 'filename{' . self::DEBUG_INFO_PROPERTY . ':' . preg_replace('/([^-\\w])/', '\\\\\\1', "file://{$node->filename}") . ';}';
    $debug .= 'line{' . self::DEBUG_INFO_PROPERTY . ":'{$node->line}';}";
    $debug .= "}\n";
  }
  elseif ($node->line_numbers) {
    $debug .= "{$indent}/* line {$node->line} {$node->filename} */\n";
  }
  return $debug;
}