/** * Imports css via @import statements * @param $source Scaffold_Source * @param $scaffold Scaffold * @return void */ public function replace_rules($source, Scaffold $scaffold) { if ($rules = $this->find_rules($source->contents)) { foreach ($rules[1] as $key => $file) { if ($file = $source->find($file)) { $this->loaded[] = $file; # Use Scaffold to compile the inner CSS file $inner = $scaffold->compile(new Scaffold_Source_File($file)); # Replace the rule $source->contents = str_replace($rules[0][$key], $inner->contents, $source->contents); } } } }