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:  * Coffee script filter
 7:  *
 8:  * @author Patrik Votoček
 9:  * @license MIT
10:  */
11: class CoffeeScriptFilter
12: {
13: 
14:     /** @var path to coffee bin */
15:     private $bin;
16: 
17:     /** @var bool */
18:     public $bare = FALSE;
19: 
20:     /**
21:      * @param string
22:      */
23:     public function __construct($bin = 'coffee')
24:     {
25:         $this->bin = $bin;
26:     }
27: 
28:     /**
29:      * Invoke filter
30:      *
31:      * @param string
32:      * @param \WebLoader\Compiler
33:      * @param string
34:      * @return string
35:      */
36:     public function __invoke($code, \WebLoader\Compiler $loader, $file = NULL)
37:     {
38:         if (pathinfo($file, PATHINFO_EXTENSION) === 'coffee') {
39:             $code = $this->compileCoffee($code);
40:         }
41: 
42:         return $code;
43:     }
44: 
45:     /**
46:      * @param string
47:      * @param bool|NULL
48:      * @return string
49:      */
50:     public function compileCoffee($source, $bare = NULL)
51:     {
52:         if (is_null($bare)) {
53:             $bare = $this->bare;
54:         }
55: 
56:         $cmd = $this->bin . ' -p -s' . ($bare ? ' -b' : '');
57: 
58:         return Process::run($cmd, $source);
59:     }
60: 
61: }
API documentation generated by ApiGen 2.8.0