Beispiel #1
0
 function testRenderingFromFile()
 {
     $stylus = new Stylus();
     $stylus->setReadDir('tests/data');
     $in = 'test.styl';
     $out = $stylus->fromFile($in)->toString();
     $correct = file_get_contents('tests/data/test.css');
     $this->assertEquals($correct, $out);
 }
Beispiel #2
0
 /**
  * Compile function. Returns a compile content, or writes it to a file if path is specified.
  *
  * @param null|string $file
  * @return string|true
  */
 public function compile($path = null)
 {
     parent::compile();
     $file = $this->getMinifiedResource();
     $file->rewind();
     $filePath = $file->getPath() . '/' . $file->getFilename();
     $stylus = new StylusCompiler();
     $string = $stylus->parseFile($filePath);
     if (null !== $path) {
         $file2 = new FileObject($path, 'w+');
         $file2->write($string);
         $string = true;
     }
     unset($file);
     unset($file2);
     return $string;
 }