Make CSS generation optional

This commit is contained in:
Miraty 2022-08-30 16:40:07 +02:00
parent 3279746223
commit fcbe9541ba

View file

@ -24,7 +24,7 @@ if (file_exists(SITE . "/config.ini"))
$config = parse_ini_file(SITE . "/config.ini");
if (!isset($config['css']))
$config['css'] = true;
$config['css'] = 1;
if (!isset($config['header']))
$config['header'] = true;
@ -35,9 +35,8 @@ if (!isset($config['centerIndex']))
if (!isset($config['defaultLang']))
$config['defaultLang'] = "";
// Less > CSS
if ($config['css'] == true) {
// Create CSS output directory if needed
if (!file_exists(SITE . "/css"))
mkdir(SITE . "/css", 0755);
@ -62,6 +61,7 @@ else
$lessFiles = array(ROOT . '/style.less' => '');
define("CSS_FILENAME", Less_Cache::Get($lessFiles, $options, $colorScheme));
}
// URLs don't end with .html on the Antopie website
function formerUrlLocale($page) {
@ -183,7 +183,7 @@ foreach ($pages as $page) {
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<?php
if ($config['css']) {
if ($config['css'] == true) {
?>
<link rel="stylesheet" media="screen" href="<?= $relativePathToRoot ?>css/<?= CSS_FILENAME ?>">
<?php
@ -243,4 +243,5 @@ foreach ($pages as $page) {
exec(GZIP . " --keep --fast --force " . $pathParts['dirname'] . "/" . $pathParts['filename'] . ".html");
}
if ($config['css'] == true)
exec(GZIP . " --keep --fast --force " . SITE . "/css/" . CSS_FILENAME);