Make CSS generation optional
This commit is contained in:
parent
3279746223
commit
fcbe9541ba
1 changed files with 25 additions and 24 deletions
49
mkht.php
49
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) {
|
|||
?>
|
||||
<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");
|
||||
}
|
||||
|
||||
exec(GZIP . " --keep --fast --force " . SITE . "/css/" . CSS_FILENAME);
|
||||
if ($config['css'] == true)
|
||||
exec(GZIP . " --keep --fast --force " . SITE . "/css/" . CSS_FILENAME);
|
||||
|
|
Loading…
Reference in a new issue