Theme folder clean up
Cleaned up the themes folder since it did not need the additional folder depth to manage bundled scripts anymore. Updated the theme engine accordingly.
This commit is contained in:
parent
0799250b8e
commit
a70bb7b2b0
20 changed files with 24 additions and 30 deletions
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -10,10 +10,8 @@ dist
|
|||
assets
|
||||
vendor
|
||||
|
||||
!src/
|
||||
src/*
|
||||
!src/themes
|
||||
src/themes/*
|
||||
!src/themes/theme-fipamo-default
|
||||
!src/themes/theme-fipamo-default/fipamo-default/assets
|
||||
!themes
|
||||
themes/*
|
||||
!themes/fipamo-default
|
||||
!themes/fipamo-default/assets
|
||||
config.json
|
|
@ -8,9 +8,6 @@ class StartKit
|
|||
{
|
||||
$config = json_decode(file_get_contents("./config.json"), true);
|
||||
$theme = $config["current_theme"];
|
||||
new ThemeEngine(
|
||||
"src/themes/theme-" . $theme,
|
||||
"/src/themes/theme-" . $theme . "/" . $theme
|
||||
);
|
||||
new ThemeEngine("themes/" . $theme);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,13 @@ class ThemeEngine
|
|||
public $loader;
|
||||
public $twig;
|
||||
|
||||
public function __construct(string $themePath, string $themeAssetPath)
|
||||
public function __construct(string $themePath)
|
||||
{
|
||||
$var = [];
|
||||
$this->themePath = $themePath;
|
||||
$this->themeAssetPath = $themeAssetPath;
|
||||
$path = explode('/', $themeAssetPath);
|
||||
$this->themeFolder = $path[4];
|
||||
$this->settings = json_decode(
|
||||
$var = [];
|
||||
$this->themePath = $themePath;
|
||||
//$path = explode('/', $themeAssetPath);
|
||||
//$this->themeFolder = $path[4];
|
||||
$this->settings = json_decode(
|
||||
file_get_contents('./data/settings.json'),
|
||||
true
|
||||
);
|
||||
|
@ -25,7 +24,7 @@ class ThemeEngine
|
|||
true
|
||||
);
|
||||
$this->loader = new \Twig\Loader\FilesystemLoader(
|
||||
$themePath . '/' . $path[4]
|
||||
$themePath . '/'
|
||||
);
|
||||
$this->twig = new \Twig\Environment($this->loader, []);
|
||||
$this->router($_SERVER['REQUEST_URI']);
|
||||
|
@ -36,7 +35,7 @@ class ThemeEngine
|
|||
$pageInfo = [
|
||||
'keywords' => $this->settings['keywords'],
|
||||
'description' => $this->settings['description'],
|
||||
'image' => $this->themeAssetPath . '/assets/images/global/default-bg.jpg',
|
||||
'image' => $this->themePath . '/assets/images/global/default-bg.jpg',
|
||||
];
|
||||
|
||||
$featureList = explode(',', $this->posts['feature']);
|
||||
|
@ -70,10 +69,10 @@ class ThemeEngine
|
|||
|
||||
$pageOptions = [
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'theme' => $this->themePath, // for theme kit
|
||||
'title' => 'This is Fipamo',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath . '/assets/images/global/default-bg.jpg',
|
||||
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
|
||||
'recent' => $recent,
|
||||
'featured' => $featured,
|
||||
'info' => $pageInfo,
|
||||
|
@ -89,10 +88,10 @@ class ThemeEngine
|
|||
$template = $request . '.twig';
|
||||
$pageOptions = [
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'theme' => $this->themePath, // for theme kit
|
||||
'title' => 'Page Title',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath . '/assets/images/global/default-bg.jpg',
|
||||
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
|
||||
'content' => $content,
|
||||
'meta' => $meta,
|
||||
'info' => $pageInfo,
|
||||
|
@ -106,10 +105,10 @@ class ThemeEngine
|
|||
$template = 'tags.twig';
|
||||
$pageOptions = [
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'theme' => $this->themePath, // for theme kit
|
||||
'title' => 'Pages Tagged as Tag',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath . '/assets/images/global/default-bg.jpg',
|
||||
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
|
||||
'tag_list' => $tags,
|
||||
'info' => $pageInfo,
|
||||
'menu' => $menu,
|
||||
|
@ -120,10 +119,10 @@ class ThemeEngine
|
|||
$template = 'archive.twig';
|
||||
$pageOptions = [
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'theme' => $this->themePath, // for theme kit
|
||||
'title' => 'Archive',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath . '/assets/images/global/default-bg.jpg',
|
||||
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
|
||||
'archives' => $archive['archives'],
|
||||
'info' => $pageInfo,
|
||||
'menu' => $menu,
|
||||
|
@ -137,10 +136,10 @@ class ThemeEngine
|
|||
$template = 'error.twig';
|
||||
$pageOptions = [
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'theme' => $this->themePath, // for theme kit
|
||||
'title' => 'Uh oh',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath . '/assets/images/global/default-bg.jpg',
|
||||
'background' => $this->themePath . '/assets/images/global/default-bg.jpg',
|
||||
'info' => $pageInfo,
|
||||
'content' => "This page is not defined",
|
||||
'menu' => $menu,
|
||||
|
|
Before (image error) Size: 24 KiB After (image error) Size: 24 KiB |
Before (image error) Size: 1 MiB After (image error) Size: 1 MiB |
Before (image error) Size: 202 KiB After (image error) Size: 202 KiB |
Before (image error) Size: 1.9 KiB After (image error) Size: 1.9 KiB |
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
{% if debug is defined %}
|
||||
{% set assetPath = '/src/themes/theme-'~theme~'/'~theme~'/assets/' %}
|
||||
{% set assetPath = theme~'/assets/' %}
|
||||
{% else %}
|
||||
{% set assetPath = '/assets/' %}
|
||||
{% endif %}
|
Loading…
Reference in a new issue