mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 18:44:30 +00:00
53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2013 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Alchemy\Phrasea\Utilities\Less;
|
|
|
|
use Alchemy\Phrasea\Utilities\Less\Compiler as LessCompiler;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Filesystem\Filesystem;
|
|
|
|
class Builder
|
|
{
|
|
/**
|
|
* @var LessCompiler
|
|
*/
|
|
protected $compiler;
|
|
/**
|
|
* @var Filesystem
|
|
*/
|
|
protected $filesystem;
|
|
|
|
public function __construct(LessCompiler $compiler, Filesystem $filesystem)
|
|
{
|
|
$this->compiler = $compiler;
|
|
$this->filesystem = $filesystem;
|
|
}
|
|
|
|
/**
|
|
* Build LESS files
|
|
*
|
|
* @param array $files
|
|
*
|
|
* @throws RuntimeException
|
|
*/
|
|
public function build($files, OutputInterface $output = null)
|
|
{
|
|
foreach ($files as $lessFile => $target) {
|
|
$this->filesystem->mkdir(dirname($target));
|
|
if (null !== $output) {
|
|
$output->writeln("\t".basename($target));
|
|
}
|
|
$this->compiler->compile($target, $lessFile);
|
|
}
|
|
}
|
|
}
|