public function registerFunction($name, $func, $prototype = null) { $this->userFunctions[$this->normalizeName($name)] = [$func, $prototype]; }
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())); }