class ScssphpFilter

Loads SCSS files using the PHP implementation of scss, scssphp.

Scss files are mostly compatible, but there are slight differences.

@link http://leafo.net/scssphp/

@author Bart van den Burg <bart@samson-it.nl>

Hierarchy

Expanded class hierarchy of ScssphpFilter

File

drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Filter/ScssphpFilter.php, line 26

Namespace

Assetic\Filter
View source
class ScssphpFilter implements DependencyExtractorInterface {
  private $compass = false;
  private $importPaths = array();
  public function enableCompass($enable = true) {
    $this->compass = (bool) $enable;
  }
  public function isCompassEnabled() {
    return $this->compass;
  }
  public function filterLoad(AssetInterface $asset) {
    $root = $asset
      ->getSourceRoot();
    $path = $asset
      ->getSourcePath();
    $lc = new \scssc();
    if ($this->compass) {
      new \scss_compass($lc);
    }
    if ($root && $path) {
      $lc
        ->addImportPath(dirname($root . '/' . $path));
    }
    foreach ($this->importPaths as $path) {
      $lc
        ->addImportPath($path);
    }
    $asset
      ->setContent($lc
      ->compile($asset
      ->getContent()));
  }
  public function setImportPaths(array $paths) {
    $this->importPaths = $paths;
  }
  public function addImportPath($path) {
    $this->importPaths[] = $path;
  }
  public function filterDump(AssetInterface $asset) {
  }
  public function getChildren(AssetFactory $factory, $content, $loadPath = null) {

    // todo
    return array();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ScssphpFilter::$compass private property
ScssphpFilter::$importPaths private property
ScssphpFilter::addImportPath public function
ScssphpFilter::enableCompass public function
ScssphpFilter::filterDump public function Filters an asset just before it's dumped. Overrides FilterInterface::filterDump
ScssphpFilter::filterLoad public function Filters an asset after it has been loaded. Overrides FilterInterface::filterLoad
ScssphpFilter::getChildren public function Returns child assets. Overrides DependencyExtractorInterface::getChildren
ScssphpFilter::isCompassEnabled public function
ScssphpFilter::setImportPaths public function