Files
newspage/classes/Application/ScssCompiler.php
2024-10-07 22:58:27 +02:00

32 lines
725 B
PHP

<?php
namespace Application;
use Application\Controller\MainController;
use ScssPhp\ScssPhp\Compiler;
use ScssPhp\ScssPhp\Exception\SassException;
use ScssPhp\ScssPhp\OutputStyle;
use ScssPhp\Server\Server;
use ScssPhp\Server\ServerException;
class ScssCompiler
{
/**
* @throws ServerException
* @throws SassException
*/
public function compile(): void
{
$scss = new Compiler();
$scss->setImportPaths(MainController::DIR_TEMPLATES);
$scss->setOutputStyle(OutputStyle::EXPANDED);
$scss->setSourceMap(Compiler::SOURCE_MAP_INLINE);
$_GET['p'] = 'main.scss';
$server = new Server(MainController::DIR_TEMPLATES, MainController::DIR_CACHE . '/scss', $scss);
$server->serve();
}
}