registerFunction() public method

Register function
public registerFunction ( string $name, callable $func, array $prototype = null )
$name string
$func callable
$prototype array
Ejemplo n.º 1
0
 public function filterLoad(AssetInterface $asset)
 {
     $sc = new Compiler();
     if ($this->compass) {
         new \scss_compass($sc);
     }
     if ($dir = $asset->getSourceDirectory()) {
         $sc->addImportPath($dir);
     }
     foreach ($this->importPaths as $path) {
         $sc->addImportPath($path);
     }
     foreach ($this->customFunctions as $name => $callable) {
         $sc->registerFunction($name, $callable);
     }
     if ($this->formatter) {
         $sc->setFormatter($this->formatter);
     }
     if (!empty($this->variables)) {
         $sc->setVariables($this->variables);
     }
     $asset->setContent($sc->compile($asset->getContent()));
 }