Source of file ScssphpFilter.php
Size: 1,814 Bytes - Last Modified: 2013-06-02T00:13:43+02:00
/home/theseer/Downloads/Symfony/vendor/kriswallsmith/assetic/src/Assetic/Filter/ScssphpFilter.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 | <?php /* * This file is part of the Assetic package, an OpenSky project. * * (c) 2010-2013 OpenSky Project Inc * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Assetic\Filter; use Assetic\Asset\AssetInterface; use Assetic\Factory\AssetFactory; /** * 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> */ class ScssphpFilter implements DependencyExtractorInterface { private $compass = false; private $importPaths = array(); public function enableCompass($enable = true) { $this->compass = (Boolean) $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(); } } |