updated dev server script to get current theme from package json

This commit is contained in:
Are0h 2022-01-31 15:57:19 -08:00
parent 659ec64fdc
commit f58c099721

View file

@ -1,6 +1,18 @@
<?php
require "vendor/autoload.php";
class StartKit
{
public function __construct()
{
$settings = json_decode(file_get_contents("./package.json"), true);
$theme = $settings["config"]["current_theme"];
new ThemeEngine(
"src/themes/theme-" . $theme,
"/src/themes/theme-" . $theme . "/" . $theme
);
}
}
class ThemeEngine
{
@ -14,6 +26,7 @@ class ThemeEngine
$path = explode("/", $themeAssetPath);
$this->themeFolder = $path[4];
$this->data = json_decode(file_get_contents("./config.json"), true);
$this->loader = new \Twig\Loader\FilesystemLoader($themePath);
$this->twig = new \Twig\Environment($this->loader, []);
$this->router($_SERVER["REQUEST_URI"]);
@ -96,7 +109,4 @@ class ThemeEngine
}
}
new ThemeEngine(
"src/themes/theme-fipamo-default",
"/src/themes/theme-fipamo-default/fipamo-default"
);
new StartKit();