10000 RC10 - cleanup by eugene-matvejev · Pull Request #72 · learn-symfony/css-compiler · GitHub
[go: up one dir, main page]

Skip to content

RC10 - cleanup #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions src/Processor/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use EM\CssCompiler\Container\FileContainer;
use EM\CssCompiler\Exception\CompilerException;
use EM\CssCompiler\Exception\FileException;
use Leafo\ScssPhp\Compiler as SASSCompiler;
use Leafo\ScssPhp\Compiler as SCSSCompiler;
use Leafo\ScssPhp\Exception\ParserException;
use lessc as LESSCompiler;
use scss_compass as CompassCompiler;
Expand Down Expand Up @@ -39,9 +39,9 @@ class Processor
*/
private $files = [];
/**
* @var SASSCompiler
* @var SCSSCompiler
*/
private $sass;
private $scss;
/**
* @var LESSCompiler
*/
Expand All @@ -50,15 +50,10 @@ class Processor
public function __construct(IOInterface $io)
{
$this->io = $io;
$this->initCompilers();
}

protected function initCompilers()
{
$this->less = new LESSCompiler();
$this->sass = new SASSCompiler();
/** attaches compass functionality to the SASS compiler */
new CompassCompiler($this->sass);
$this->scss = new SCSSCompiler();
/** attaches compass functionality to the SCSS compiler */
new CompassCompiler($this->scss);
}

/**
Expand Down Expand Up @@ -132,7 +127,7 @@ public function saveOutput()
*/
public function processFiles($formatter)
{
$this->sass->setFormatter($this->getFormatterClass($formatter));
$this->scss->setFormatter($this->getFormatterClass($formatter));
$this->io->write("<info>use '{$formatter}' formatting</info>");

foreach ($this->files as $file) {
Expand Down Expand Up @@ -174,8 +169,8 @@ public function processFile(FileContainer $file)
protected function compileSCSS(FileContainer $file)
{
try {
$this->sass->addImportPath(dirname($file->getInputPath()));
$content = $this->sass->compile($file->getInputContent());
$this->scss->addImportPath(dirname($file->getInputPath()));
$content = $this->scss->compile($file->getInputContent());

return $file->setOutputContent($content);
} catch (ParserException $e) {
Expand Down
0