function test_Import() { $this->dir('Import'); $original = file_get_contents($this->dir() . 'in.css'); $expected = file_get_contents($this->dir() . 'out.css'); Scaffold::$current['file'] = $this->dir() . 'in.css'; Scaffold::add_include_path($this->dir()); $css = Import::import_process($original); $this->assertEqual($expected, $css); }
/** * Parses the single CSS file * * @param $file The file to the parsed * @return $css string */ public static function process($file) { /** * This allows Scaffold to find files in the directory of the CSS file */ Scaffold::add_include_path($file); /** * We create a new CSS object for each file. This object * allows modules to easily manipulate the CSS string. * Note:Inline comments are stripped when the file is loaded. */ Scaffold::$css = new Scaffold_CSS($file); /** * Import Process Hook * This hook is for doing any type of importing/including in the CSS */ self::hook('import_process'); /** * Pre-process Hook * There shouldn't be any heavy processing of the string here. Just pulling * out @ rules, constants and other bits and pieces. */ self::hook('pre_process'); /** * Process Hook * The main process. None of the processes should conflict in any of the modules */ self::hook('process'); /** * Post-process Hook * After any non-standard CSS has been processed and removed. This is where * the nested selectors are parsed. It's not perfectly standard CSS yet, but * there shouldn't be an Scaffold syntax left at all. */ self::hook('post_process'); /** * Formatting Hook * Stylise the string, rewriting urls and other parts of the string. No heavy processing. */ self::hook('formatting_process'); /** * Clean up the include paths */ self::remove_include_path($file); // Webligo PHP5.1compat if (Scaffold::$css instanceof Scaffold_CSS) { return Scaffold::$css->__toString(); } else { return (string) Scaffold::$css; } }