source: sandbox/newExpressoMail/newExpressoMail/Assetic/Filter/ScssphpFilter.php @ 7265

Revision 7265, 1.3 KB checked in by gustavo, 12 years ago (diff)

Ticket #0000 - Criado novo modulo para o desenvolvimento do novo ExpressoMail?

  • Property svn:executable set to *
Line 
1<?php
2
3/*
4 * This file is part of the Assetic package, an OpenSky project.
5 *
6 * (c) 2010-2012 OpenSky Project Inc
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Assetic\Filter;
13
14use Assetic\Asset\AssetInterface;
15
16/**
17 * Loads SCSS files using the PHP implementation of scss, scssphp.
18 *
19 * Scss files are mostly compatible, but there are slight differences.
20 *
21 * @link http://leafo.net/scssphp/
22 *
23 * @author Bart van den Burg <bart@samson-it.nl>
24 */
25class ScssphpFilter implements FilterInterface
26{
27    private $compass = false;
28
29    public function enableCompass($enable = true)
30    {
31        $this->compass = (Boolean) $enable;
32    }
33
34    public function isCompassEnabled()
35    {
36        return $this->compass;
37    }
38
39    public function filterLoad(AssetInterface $asset)
40    {
41        $root = $asset->getSourceRoot();
42        $path = $asset->getSourcePath();
43
44        $lc = new \scssc();
45        if ($this->compass) {
46            new \scss_compass($lc);
47        }
48        if ($root && $path) {
49            $lc->addImportPath(dirname($root.'/'.$path));
50        }
51
52        $asset->setContent($lc->compile($asset->getContent()));
53    }
54
55    public function filterDump(AssetInterface $asset)
56    {
57    }
58}
Note: See TracBrowser for help on using the repository browser.