mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
support sass compilation in staging
This commit is contained in:
parent
8f9166cd68
commit
99df9a18ec
3 changed files with 26 additions and 17 deletions
18
update.php
18
update.php
|
@ -15,24 +15,8 @@ if (!$force && !file_exists($needsUpdateFile))
|
|||
|
||||
@unlink($needsUpdateFile);
|
||||
|
||||
|
||||
chdir(ROOT_DIR);
|
||||
|
||||
Shell::exec('git fetch && git reset --hard origin/master');
|
||||
|
||||
$scss = new \Leafo\ScssPhp\Compiler();
|
||||
|
||||
$scss->setImportPaths([ROOT_DIR.'/web/scss']);
|
||||
|
||||
$compress = true;
|
||||
if ($compress)
|
||||
{
|
||||
$scss->setFormatter('Leafo\ScssPhp\Formatter\Crunched');
|
||||
}
|
||||
else
|
||||
{
|
||||
$scss->setFormatter('Leafo\ScssPhp\Formatter\Expanded');
|
||||
$scss->setLineNumberStyle(Leafo\ScssPhp\Compiler::LINE_COMMENTS);
|
||||
}
|
||||
|
||||
file_put_contents(ROOT_DIR.'/web/css/all.css', $scss->compile(file_get_contents(ROOT_DIR.'/web/scss/all.scss')));
|
||||
View::compileCss();
|
||||
|
|
|
@ -89,4 +89,25 @@ class View
|
|||
{
|
||||
return static::$metaImg ?: '//lbry.io/img/lbry-dark-1600x528.png';
|
||||
}
|
||||
|
||||
public static function compileCss()
|
||||
{
|
||||
$scssCompiler = new \Leafo\ScssPhp\Compiler();
|
||||
|
||||
$scssCompiler->setImportPaths([ROOT_DIR.'/web/scss']);
|
||||
|
||||
$compress = true;
|
||||
if ($compress)
|
||||
{
|
||||
$scssCompiler->setFormatter('Leafo\ScssPhp\Formatter\Crunched');
|
||||
}
|
||||
else
|
||||
{
|
||||
$scssCompiler->setFormatter('Leafo\ScssPhp\Formatter\Expanded');
|
||||
$scssCompiler->setLineNumberStyle(Leafo\ScssPhp\Compiler::LINE_COMMENTS);
|
||||
}
|
||||
|
||||
$css = $scssCompiler->compile(file_get_contents(ROOT_DIR.'/web/scss/all.scss'));
|
||||
file_put_contents(ROOT_DIR.'/web/css/all.css', $css);
|
||||
}
|
||||
}
|
|
@ -9,6 +9,10 @@ try
|
|||
{
|
||||
i18n::register();
|
||||
Session::init();
|
||||
if (!IS_PRODUCTION)
|
||||
{
|
||||
View::compileCss();
|
||||
}
|
||||
Controller::dispatch(strtok($_SERVER['REQUEST_URI'], '?'));
|
||||
}
|
||||
catch(Exception $e)
|
||||
|
|
Loading…
Add table
Reference in a new issue