updated dev server script to get current theme from package json

develop
Are0h 3 years ago
parent 659ec64fdc
commit f58c099721

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

Loading…
Cancel
Save