From dbe74e13ca30953f35f726cf26c532527ce4b4e9 Mon Sep 17 00:00:00 2001 From: Are0h Date: Sat, 5 Feb 2022 23:27:02 +0000 Subject: [PATCH] removed hardcoded theme paths in templates --- config.json | 1 + index.php | 23 +- package.json | 8 +- src/themes/theme-fipamo-default/com/Start.js | 9 - .../fipamo-default/archive.twig | 2 +- .../fipamo-default/frame.twig | 2 +- .../fipamo-default/index.twig | 2 +- .../fipamo-default/page.twig | 2 +- .../fipamo-default/tags.twig | 2 +- .../styles/_structure.sass | 370 ++++++++++-------- 10 files changed, 231 insertions(+), 190 deletions(-) delete mode 100644 src/themes/theme-fipamo-default/com/Start.js diff --git a/config.json b/config.json index 96b3d45..604bf74 100644 --- a/config.json +++ b/config.json @@ -6,6 +6,7 @@ "base_path": "/src/front/", "default_bg": "/assets/images/global/default-bg.jpg", "default_avi": "/assets/images/global/default-avi.png", + "index-content": "
The path of the righteous man is beset on ALL sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.", "content": "
The path of the righteous man is beset on ALL sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.
server\n { listen 80; server_name yourcoolassdomain.com; \n\tlocation / \n\t\t{ \n\t\t\tproxy_pass https://127.0.0.1:2314; \n\t\t\tproxy_http_version 1.1; \n\t\t\tproxy_set_header \n\t\t\tUpgrade $http_upgrade; \n\t\t\tproxy_set_header Connection 'upgrade'; \n\t\t\tproxy_set_header Host $host; \n\t\t\tproxy_cache_bypass $http_upgrade; \n\t\t} \n\t} 
", "bucket": [{ "item": "one" }, { "item": "two" }, { "item": "three" }], "tag_list": [ diff --git a/index.php b/index.php index 822d46d..09c1d25 100644 --- a/index.php +++ b/index.php @@ -26,8 +26,9 @@ 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->loader = new \Twig\Loader\FilesystemLoader( + $themePath . "/" . $path[4] + ); $this->twig = new \Twig\Environment($this->loader, []); $this->router($_SERVER["REQUEST_URI"]); } @@ -45,10 +46,12 @@ class ThemeEngine case "/": $recent = $this->data["recent_posts"]; $featured = $this->data["featured_posts"]; - $template = $this->themeFolder . "/index.twig"; + $template = "index.twig"; + $content = $this->data["index-content"]; $pageOptions = [ - "debug" => true, + "debug" => true, //for theme kit + "theme" => $this->themeFolder, //for theme kit "title" => "This is Fipamo", "background" => $this->themeAssetPath . "/assets/images/global/default-bg.jpg", @@ -56,14 +59,16 @@ class ThemeEngine "featured" => $featured, "info" => $pageInfo, "menu" => $menu, + "content" => $content, ]; break; case "/page": $content = $this->data["content"]; $meta = $this->data["meta"]; - $template = $this->themeFolder . "/page.twig"; + $template = $request . ".twig"; $pageOptions = [ - "debug" => true, + "debug" => true, //for theme kit + "theme" => $this->themeFolder, //for theme kit "title" => "Page Title", "background" => $this->themeAssetPath . "/assets/images/global/default-bg.jpg", @@ -77,7 +82,8 @@ class ThemeEngine $tags = $this->data["tag_list"]; $template = $this->themeFolder . "/tags.twig"; $pageOptions = [ - "debug" => true, + "debug" => true, //for theme kit + "theme" => $this->themeFolder, //for theme kit "title" => "Pages Tagged as Tag", "background" => $this->themeAssetPath . "/assets/images/global/default-bg.jpg", @@ -90,7 +96,8 @@ class ThemeEngine $archive = $this->data["archives"]; $template = $this->themeFolder . "/archive.twig"; $pageOptions = [ - "debug" => true, + "debug" => true, //for theme kit + "theme" => $this->themeFolder, //for theme kit "title" => "Archive", "background" => $this->themeAssetPath . "/assets/images/global/default-bg.jpg", diff --git a/package.json b/package.json index 3c99da8..1772e93 100644 --- a/package.json +++ b/package.json @@ -7,16 +7,16 @@ "sass": "^1.49.0" }, "scripts": { - "watch": "npx parcel watch $npm_package_config_theme_path/styles/base.sass --dist-dir $npm_package_config_theme_dir/assets/css --public-url /assets/css & npx parcel watch $npm_package_config_theme_path/com/Start.js --dist-dir $npm_package_config_theme_dir/assets/scripts --public-url /assets/scripts", - "build": "npx parcel build $npm_package_config_theme_path/styles/base.sass --dist-dir $npm_package_config_theme_dir/assets/css --public-url /assets/css & npx parcel build $npm_package_config_theme_path/com/Start.js --dist-dir $npm_package_config_theme_dir/assets/scripts --public-url /assets/scripts", + "watch": "sass --watch $npm_package_config_theme_path/styles:$npm_package_config_theme_dir/assets/css & npx parcel watch $npm_package_config_theme_path/com/ThemeStart.js --dist-dir $npm_package_config_theme_dir/assets/scripts --public-url /assets/scripts ", + "build": "npx parcel build $npm_package_config_theme_path/styles/base.sass --dist-dir $npm_package_config_theme_dir/assets/css --public-url /assets/css & npx parcel build $npm_package_config_theme_path/com/ThemeStart.js --dist-dir $npm_package_config_theme_dir/assets/scripts --public-url /assets/scripts", "dev": "php -S localhost:$npm_package_config_port" }, "license": "UNLICENSED", "config": { "port": "1414", "current_theme": "fipamo-default", - "theme_path": "src/themes/theme-$npm_package_config_current_theme", - "theme_dir": "src/themes/theme-$npm_package_config_current_theme/$npm_package_config_current_theme" + "theme_path": "src/themes/theme-fipamo-default", + "theme_dir": "src/themes/theme-fipamo-default/fipamo-default" }, "devDependencies": { "@parcel/transformer-sass": "^2.2.1" diff --git a/src/themes/theme-fipamo-default/com/Start.js b/src/themes/theme-fipamo-default/com/Start.js deleted file mode 100644 index 6f275a3..0000000 --- a/src/themes/theme-fipamo-default/com/Start.js +++ /dev/null @@ -1,9 +0,0 @@ -import Base from "./Base.js"; - -document.addEventListener( - "DOMContentLoaded", - function () { - var base = new Base(); - }, - false -); diff --git a/src/themes/theme-fipamo-default/fipamo-default/archive.twig b/src/themes/theme-fipamo-default/fipamo-default/archive.twig index 18c7b02..47a441f 100644 --- a/src/themes/theme-fipamo-default/fipamo-default/archive.twig +++ b/src/themes/theme-fipamo-default/fipamo-default/archive.twig @@ -1,4 +1,4 @@ -{% extends "fipamo-default/frame.twig" %} +{% extends "frame.twig" %} {% block title %} {{ title }} diff --git a/src/themes/theme-fipamo-default/fipamo-default/frame.twig b/src/themes/theme-fipamo-default/fipamo-default/frame.twig index 227686b..3ff7818 100644 --- a/src/themes/theme-fipamo-default/fipamo-default/frame.twig +++ b/src/themes/theme-fipamo-default/fipamo-default/frame.twig @@ -1,7 +1,7 @@ {% if debug is defined %} - {% set assetPath = '/src/themes/theme-fipamo-default/fipamo-default/assets/' %} + {% set assetPath = '/src/themes/theme-'~theme~'/'~theme~'/assets/' %} {% else %} {% set assetPath = '/assets/' %} {% endif %} diff --git a/src/themes/theme-fipamo-default/fipamo-default/index.twig b/src/themes/theme-fipamo-default/fipamo-default/index.twig index 48c3c08..c4fe932 100644 --- a/src/themes/theme-fipamo-default/fipamo-default/index.twig +++ b/src/themes/theme-fipamo-default/fipamo-default/index.twig @@ -1,4 +1,4 @@ -{% extends "fipamo-default/frame.twig" %} +{% extends "frame.twig" %} {% block title %} {{ title }} diff --git a/src/themes/theme-fipamo-default/fipamo-default/page.twig b/src/themes/theme-fipamo-default/fipamo-default/page.twig index 6d9852d..31c323e 100644 --- a/src/themes/theme-fipamo-default/fipamo-default/page.twig +++ b/src/themes/theme-fipamo-default/fipamo-default/page.twig @@ -1,4 +1,4 @@ -{% extends "fipamo-default/frame.twig" %} +{% extends "frame.twig" %} {% block title %} {{ title }} diff --git a/src/themes/theme-fipamo-default/fipamo-default/tags.twig b/src/themes/theme-fipamo-default/fipamo-default/tags.twig index 2c239f4..0254a9d 100644 --- a/src/themes/theme-fipamo-default/fipamo-default/tags.twig +++ b/src/themes/theme-fipamo-default/fipamo-default/tags.twig @@ -1,4 +1,4 @@ -{% extends "fipamo-default/frame.twig" %} +{% extends "frame.twig" %} {% block title %} {{ title }} diff --git a/src/themes/theme-fipamo-default/styles/_structure.sass b/src/themes/theme-fipamo-default/styles/_structure.sass index d0ce956..a35a8d6 100644 --- a/src/themes/theme-fipamo-default/styles/_structure.sass +++ b/src/themes/theme-fipamo-default/styles/_structure.sass @@ -1,184 +1,226 @@ -html, body - font: 400 1em $baseType +html + margin: 0 + padding: 0 + width: 100% height: 100% + overflow: hidden + font: 400 1.2em/1.4em $baseType + body - background: $primary + background: $white + margin: 0 + padding: 0 + perspective: 1px + transform-style: preserve-3d + height: 100% + width: 100% + overflow-y: scroll + overflow-x: hidden + a + color: $primary text-decoration: none - color: $tertiary - border-bottom: 1px $secondary solid + border-bottom: 1px solid $highlight + //@include object-transitions(.2s) &:hover - color: $secondary - border-bottom: 1px $tertiary solid + border-bottom: 1px solid $secondary -#main - width: 100% - height: 100% +code + background: $black + color: $highlight + border-radius: 3px + padding: 3px + +pre + background: $black + color: $highlight + border-radius: 3px + padding: 3px +code + color: $secondary + background: none + +svg.icons + width: 25px + fill: $white + +header background: $primary - header - width: 100% - height: 100% - background-size: cover - background: $black - border-top: 2px $tertiary solid - #cover - position: relative - height: 100% - width: 100% - .that-logo - width: 300px - height: 300px + height: 90% + width: 100% + border-top: $white 3px solid +nav + width: 97% + margin: 10px auto + color: $primary + .left,.right + width: 50% + display: inline-block + vertical-align: top + .left + a.logo-link + border-bottom: none + margin: 0 0 20px 0 display: block - position: absolute - z-index: 1000 - margin: -50px 0 0 -50px - cursor: pointer - .wrapper - width: 100% - max-width: 1024px - min-height: 400px - margin: 0 auto - article.index - padding: 20px - div - span - color: #fff - display: inline-block - vertical-align: top - width: 15% - font-family: $monoType - font-size: .8em - div - width: 80% - color: $white - font-weight: 800 - font-size: 2em - margin: -5px 0 0 0 - padding: 0 - display: inline-block - overflow: hidden - p - padding: 0 - margin: 0 - #recent-links - a - font-size: 2em - font-weight: 800 - display: inline-block - margin: -8px 0 10px 0 - label - color: $secondary - font-weight: 800 - font-size: 3.5em - display: block - margin: 60px 0 20px 15% - article.page - width: 100% - #title + #logo + width: 50px + border-bottom: none + .right + text-align: right + a.menu-link + background: $secondary + margin-bottom: 4px + padding: 3px + border-radius: 2px + display: inline-block + font-size: 0.8em + border-bottom: none + &:hover background: $secondary - color: $tertiary - padding: 40px - font-size: 3em - font-weight: 800 - - #page_desc - padding: 40px - color: $secondary - font-size: 1.5em - img - width: 90% - margin: 0 auto + + + +.container + z-index: 2 + background: $white + line-height: 30px + font-weight: lighter + width: 100% + //padding 40px + color: $black + article + position: relative + width: 80% + height: 80% + max-width: 840px + //min-height 500px + background: $white + vertical-align: top + color: $black + margin: 0 auto + //.index, .page + //margin 30px + .index, .page + padding: 0 0 15px 0 + img display: block - article#archive + width: 100% + h1 + color: $primary + p + font: 300 1.25em/1.6em $baseType + //meta datea for page + .meta + font: 500 0.8em/1.3em $baseType + padding: 5px 0 0 0 + border-top: 1px solid $primary + background: $white + a + font-size: 0.8em + font-weight: 400 + //archive styling .archive-item - width: 50% - display: inline-block - vertical-align: top - margin-bottom: 100px - span.year - width: 100% - font-size: 2em + padding: 15px 0 20px 0 + span.year + font-size: 1.5em + font-weight: 500 + padding: 5px + display: block + color: $primary .archive-month - margin: 0 0 20px 0 - font-size: 1em + display: inline-block + vertical-align: top + width: 30% + padding: 5px span.month - width: 100% + color: $secondary font-size: 1.5em + font-weight: 300 + padding: 5px display: block - a - font-size: .8em - font-weight: 400 - - - footer - background: $secondary - overflow: hidden - .inner + section + padding: 0 0 20px 0 + background: $primary + a + color: $white + .index-lists, .page-title + max-width: 840px + span + font-size: 2em + color: $secondary + font-weight: 400 width: 80% - max-width: 964px margin: 0 auto - padding: 20px - color: $white + padding: 20px 0 0 0 + .recent, .featured + display: inline-block + width: 50% + vertical-align: top + label + background: $black + color: $white + font-size: 1.5em + line-height: 1.3 -//Responsive -@media only screen and (max-width: 768px) - #main - .wrapper - article.index - div - span - font-size: .64em - width: 14% - div - font-size: 1.7em - #recent-links - a - font-size: 1.7em - label - font-size: 3em - margin: 50px 0 20px 14% - article.page - #title - font-size: 2.5em - #page_desc - padding: 30px - color: $secondary - font-size: 1.4em - img - width: 100% - margin: 0 auto - display: block - - - @media only screen and (max-width: 480px) - #main - .wrapper - article.index - div - span - font-size: .64em - width: 100% - div - font-size: 1.6em - width: 100% - #recent-links - a - font-size: 1.5em - label - font-size: 3em - margin: 40px 0 20px 0 - article.page - #title - font-size: 1.8em - #page_desc - padding: 30px - color: $secondary - font-size: 1.2em - img - width: 100% - margin: 0 auto - display: block - + + +footer + background: $white + padding: 10px + color: $primary + font-size: 0.8em + font-weight: 600 + height: 100px + .inner + margin: 20px auto + width: 80% + max-width: 840px + a + color: $secondary + - \ No newline at end of file +// RESPONSIVE + +@media only screen and (max-width: 640px) +header + nav + width: 98% + span + font-size: 2.5em + .container + article + .index, .page + .archive-item + .archive-month + width: 45% + +@media only screen and (max-width: 480px) +header + nav + width: 96% + .container + article + .index, .page + margin: 0 + p + font: 300 1em/1.6em $baseType + section + .index-lists + .recent, .featured + width: 100% !important + + +@media only screen and (max-width: 375px) +header + nav + width: 95% +.container + article + .index, .page + margin: 0 + p + font: 300 0.9em/1.7em $baseType + .archive-item + .archive-month + width: 95% \ No newline at end of file