public static function SassFile::get_tree in Sassy 7.3
Returns the parse tree for a file. If caching is enabled a cached version will be used if possible; if not the parsed file will be cached.
Parameters
string filename to parse:
SassParser Sass parser:
Return value
1 call to SassFile::get_tree()
- SassImportNode::parse in phpsass/
tree/ SassImportNode.php - Parse this node. If the node is a CSS import return the CSS import rule. Else returns the rendered tree for the file.
File
- phpsass/
SassFile.php, line 37
Class
- SassFile
- SassFile class. @package PHamlP @subpackage Sass
Code
public static function get_tree($filename, $parser) {
if ($parser->cache) {
$cached = self::get_cached_file($filename, $parser->cache_location);
if ($cached !== false) {
return $cached;
}
}
$contents = file_get_contents($filename) . "\n\n ";
#add some whitespace to fix bug
SassFile::$parser = $parser;
SassFile::$path = $filename;
$contents = preg_replace_callback('/url\\(\\s*[\'"]?(?![a-z]+:|\\/+)([^\'")]+)[\'"]?\\s*\\)/i', 'SassFile::resolve_paths', $contents);
$sassParser = new SassParser(array_merge($parser->options, array(
'line' => 1,
)));
$tree = $sassParser
->parse($contents, FALSE);
if ($parser->cache) {
self::set_cached_file($tree, $filename, $parser->cache_location);
}
return $tree;
}