Overview

Namespaces

  • Budovy
  • Kdyby
    • BootstrapFormRenderer
      • DI
      • Latte
  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Diagnostics
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
      • Diagnostics
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • PhpGenerator
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
  • NetteModule
  • Nextras
    • Datagrid
  • None
  • PHP
  • Tester
    • CodeCoverage
    • Runner
      • Output
  • Vodacek
    • Forms
      • Controls
  • WebLoader
    • Filter
    • Nette

Classes

  • CoffeeScriptFilter
  • LessFilter
  • Process
  • StylusFilter
  • VariablesFilter
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: namespace WebLoader\Filter;
 4: 
 5: /**
 6:  * Stylus filter
 7:  *
 8:  * @author Patrik Votoček
 9:  * @license MIT
10:  */
11: class StylusFilter
12: {
13: 
14:     /** @var string */
15:     private $bin;
16: 
17:     /** @var bool */
18:     public $compress = FALSE;
19: 
20:     /** @var bool */
21:     public $includeCss = FALSE;
22: 
23:     /**
24:      * @param string
25:      */
26:     public function __construct($bin = 'stylus')
27:     {
28:         $this->bin = $bin;
29:     }
30: 
31:     /**
32:      * Invoke filter
33:      *
34:      * @param string
35:      * @param \WebLoader\Compiler
36:      * @param string
37:      * @return string
38:      */
39:     public function __invoke($code, \WebLoader\Compiler $loader, $file = NULL)
40:     {
41:         if (pathinfo($file, PATHINFO_EXTENSION) === 'styl') {
42:             $path =
43:             $cmd = $this->bin . ($this->compress ? ' -c' : '') . ($this->includeCss ? ' --include-css' : '') . ' -I ' . pathinfo($file, PATHINFO_DIRNAME);
44:             try {
45:                 $code = Process::run($cmd, $code);
46:             } catch (\RuntimeException $e) {
47:                 throw new \WebLoader\WebLoaderException('Stylus Filter Error', 0, $e);
48:             }
49:         }
50: 
51:         return $code;
52:     }
53: 
54: }
55: 
API documentation generated by ApiGen 2.8.0