コード例 #1
0
ファイル: Filter.php プロジェクト: B7th/tale-jade
 /**
  * Compiles the Stylus content to CSS
  *
  * @param Node   $node    the node to be compiled
  * @param string $indent  the indentation to use on each child
  * @param string $newLine the new-line to append after each line
  *
  * @return string the wrapped Stylus-CSS-string
  * @throws Compiler\Exception when the Stylus package is not installed
  */
 public static function filterStylus(Node $node, $indent, $newLine)
 {
     if (!class_exists('Stylus\\Stylus')) {
         throw new Compiler\Exception("Failed to compile Stylus: " . "Please install the neemzy/stylus composer package");
     }
     $stylus = new \Stylus\Stylus();
     $css = $stylus->fromString($node->text())->toString();
     return '<style>' . $newLine . $indent . $css . $newLine . $indent . '</style>';
 }
コード例 #2
0
ファイル: styl.php プロジェクト: juijs/store.jui.io
<?php

// Stylus Preprocessor
//
header('Content-Type: text/css');
if (!hasCache($file) || $is_new) {
    $stylus = new \Stylus\Stylus();
    $stylus->setReadDir($dir);
    $stylus->setImportDir($dir);
    $content = $stylus->fromFile($relative_path)->toString();
    generateCache($file, $content);
}
outputCache($file);