From fcbe9541bac5d1580f78520ed65e2baebd1bc06f Mon Sep 17 00:00:00 2001 From: Miraty Date: Tue, 30 Aug 2022 16:40:07 +0200 Subject: [PATCH] Make CSS generation optional --- mkht.php | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/mkht.php b/mkht.php index 147cb4f..fc2b04b 100755 --- a/mkht.php +++ b/mkht.php @@ -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,33 +35,33 @@ 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); -// Create CSS output directory if needed -if (!file_exists(SITE . "/css")) - mkdir(SITE . "/css", 0755); + require ROOT . "/less.php/lib/Less/Autoloader.php"; + Less_Autoloader::register(); -require ROOT . "/less.php/lib/Less/Autoloader.php"; -Less_Autoloader::register(); + $colorScheme = array( + "darkColor" => "black", + "lightColor" => "white", + "mainColor" => "red", + ); -$colorScheme = array( - "darkColor" => "black", - "lightColor" => "white", - "mainColor" => "red", -); + $options = array( + 'cache_dir' => SITE . '/css', + 'compress' => true, + ); -$options = array( - 'cache_dir' => SITE . '/css', - 'compress' => true, -); + if (file_exists(SITE . "/style.less")) + $lessFiles = array(ROOT . '/style.less' => '', SITE . '/style.less' => ''); + else + $lessFiles = array(ROOT . '/style.less' => ''); -if (file_exists(SITE . "/style.less")) - $lessFiles = array(ROOT . '/style.less' => '', SITE . '/style.less' => ''); -else - $lessFiles = array(ROOT . '/style.less' => ''); - -define("CSS_FILENAME", Less_Cache::Get($lessFiles, $options, $colorScheme)); + 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) { ?>