removed hardcoded theme paths in templates

This commit is contained in:
Are0h 2022-02-05 23:27:02 +00:00
parent f58c099721
commit dbe74e13ca
10 changed files with 240 additions and 199 deletions

View file

@ -6,6 +6,7 @@
"base_path": "/src/front/", "base_path": "/src/front/",
"default_bg": "/assets/images/global/default-bg.jpg", "default_bg": "/assets/images/global/default-bg.jpg",
"default_avi": "/assets/images/global/default-avi.png", "default_avi": "/assets/images/global/default-avi.png",
"index-content": "<img src='/assets/images/global/default-avi.png'><br>The path of the <a href='#'>righteous</a> 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. <code>And I will strike down upon thee with great vengeance</code> 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": "<img src='/assets/images/global/default-avi.png'><br>The path of the <a href='#'>righteous</a> 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. <code>And I will strike down upon thee with great vengeance</code> 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.<pre><code>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} </code></pre>", "content": "<img src='/assets/images/global/default-avi.png'><br>The path of the <a href='#'>righteous</a> 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. <code>And I will strike down upon thee with great vengeance</code> 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.<pre><code>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} </code></pre>",
"bucket": [{ "item": "one" }, { "item": "two" }, { "item": "three" }], "bucket": [{ "item": "one" }, { "item": "two" }, { "item": "three" }],
"tag_list": [ "tag_list": [

View file

@ -26,8 +26,9 @@ 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(
$this->loader = new \Twig\Loader\FilesystemLoader($themePath); $themePath . "/" . $path[4]
);
$this->twig = new \Twig\Environment($this->loader, []); $this->twig = new \Twig\Environment($this->loader, []);
$this->router($_SERVER["REQUEST_URI"]); $this->router($_SERVER["REQUEST_URI"]);
} }
@ -45,10 +46,12 @@ class ThemeEngine
case "/": case "/":
$recent = $this->data["recent_posts"]; $recent = $this->data["recent_posts"];
$featured = $this->data["featured_posts"]; $featured = $this->data["featured_posts"];
$template = $this->themeFolder . "/index.twig"; $template = "index.twig";
$content = $this->data["index-content"];
$pageOptions = [ $pageOptions = [
"debug" => true, "debug" => true, //for theme kit
"theme" => $this->themeFolder, //for theme kit
"title" => "This is Fipamo", "title" => "This is Fipamo",
"background" => "background" =>
$this->themeAssetPath . "/assets/images/global/default-bg.jpg", $this->themeAssetPath . "/assets/images/global/default-bg.jpg",
@ -56,14 +59,16 @@ class ThemeEngine
"featured" => $featured, "featured" => $featured,
"info" => $pageInfo, "info" => $pageInfo,
"menu" => $menu, "menu" => $menu,
"content" => $content,
]; ];
break; break;
case "/page": case "/page":
$content = $this->data["content"]; $content = $this->data["content"];
$meta = $this->data["meta"]; $meta = $this->data["meta"];
$template = $this->themeFolder . "/page.twig"; $template = $request . ".twig";
$pageOptions = [ $pageOptions = [
"debug" => true, "debug" => true, //for theme kit
"theme" => $this->themeFolder, //for theme kit
"title" => "Page Title", "title" => "Page Title",
"background" => "background" =>
$this->themeAssetPath . "/assets/images/global/default-bg.jpg", $this->themeAssetPath . "/assets/images/global/default-bg.jpg",
@ -77,7 +82,8 @@ class ThemeEngine
$tags = $this->data["tag_list"]; $tags = $this->data["tag_list"];
$template = $this->themeFolder . "/tags.twig"; $template = $this->themeFolder . "/tags.twig";
$pageOptions = [ $pageOptions = [
"debug" => true, "debug" => true, //for theme kit
"theme" => $this->themeFolder, //for theme kit
"title" => "Pages Tagged as Tag", "title" => "Pages Tagged as Tag",
"background" => "background" =>
$this->themeAssetPath . "/assets/images/global/default-bg.jpg", $this->themeAssetPath . "/assets/images/global/default-bg.jpg",
@ -90,7 +96,8 @@ class ThemeEngine
$archive = $this->data["archives"]; $archive = $this->data["archives"];
$template = $this->themeFolder . "/archive.twig"; $template = $this->themeFolder . "/archive.twig";
$pageOptions = [ $pageOptions = [
"debug" => true, "debug" => true, //for theme kit
"theme" => $this->themeFolder, //for theme kit
"title" => "Archive", "title" => "Archive",
"background" => "background" =>
$this->themeAssetPath . "/assets/images/global/default-bg.jpg", $this->themeAssetPath . "/assets/images/global/default-bg.jpg",

View file

@ -7,16 +7,16 @@
"sass": "^1.49.0" "sass": "^1.49.0"
}, },
"scripts": { "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", "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/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/ThemeStart.js --dist-dir $npm_package_config_theme_dir/assets/scripts --public-url /assets/scripts",
"dev": "php -S localhost:$npm_package_config_port" "dev": "php -S localhost:$npm_package_config_port"
}, },
"license": "UNLICENSED", "license": "UNLICENSED",
"config": { "config": {
"port": "1414", "port": "1414",
"current_theme": "fipamo-default", "current_theme": "fipamo-default",
"theme_path": "src/themes/theme-$npm_package_config_current_theme", "theme_path": "src/themes/theme-fipamo-default",
"theme_dir": "src/themes/theme-$npm_package_config_current_theme/$npm_package_config_current_theme" "theme_dir": "src/themes/theme-fipamo-default/fipamo-default"
}, },
"devDependencies": { "devDependencies": {
"@parcel/transformer-sass": "^2.2.1" "@parcel/transformer-sass": "^2.2.1"

View file

@ -1,9 +0,0 @@
import Base from "./Base.js";
document.addEventListener(
"DOMContentLoaded",
function () {
var base = new Base();
},
false
);

View file

@ -1,4 +1,4 @@
{% extends "fipamo-default/frame.twig" %} {% extends "frame.twig" %}
{% block title %} {% block title %}
{{ title }} {{ title }}

View file

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
{% if debug is defined %} {% if debug is defined %}
{% set assetPath = '/src/themes/theme-fipamo-default/fipamo-default/assets/' %} {% set assetPath = '/src/themes/theme-'~theme~'/'~theme~'/assets/' %}
{% else %} {% else %}
{% set assetPath = '/assets/' %} {% set assetPath = '/assets/' %}
{% endif %} {% endif %}

View file

@ -1,4 +1,4 @@
{% extends "fipamo-default/frame.twig" %} {% extends "frame.twig" %}
{% block title %} {% block title %}
{{ title }} {{ title }}

View file

@ -1,4 +1,4 @@
{% extends "fipamo-default/frame.twig" %} {% extends "frame.twig" %}
{% block title %} {% block title %}
{{ title }} {{ title }}

View file

@ -1,4 +1,4 @@
{% extends "fipamo-default/frame.twig" %} {% extends "frame.twig" %}
{% block title %} {% block title %}
{{ title }} {{ title }}

View file

@ -1,184 +1,226 @@
html, body html
font: 400 1em $baseType
height: 100%
body
background: $primary
a
text-decoration: none
color: $tertiary
border-bottom: 1px $secondary solid
&:hover
color: $secondary
border-bottom: 1px $tertiary solid
#main
width: 100%
height: 100%
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
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 margin: 0
#recent-links padding: 0
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% width: 100%
#title height: 100%
background: $secondary overflow: hidden
color: $tertiary font: 400 1.2em/1.4em $baseType
padding: 40px
font-size: 3em
font-weight: 800
#page_desc body
padding: 40px 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
border-bottom: 1px solid $highlight
//@include object-transitions(.2s)
&:hover
border-bottom: 1px solid $secondary
code
background: $black
color: $highlight
border-radius: 3px
padding: 3px
pre
background: $black
color: $highlight
border-radius: 3px
padding: 3px
code
color: $secondary color: $secondary
font-size: 1.5em background: none
img
width: 90% svg.icons
margin: 0 auto width: 25px
display: block fill: $white
article#archive
.archive-item header
background: $primary
height: 90%
width: 100%
border-top: $white 3px solid
nav
width: 97%
margin: 10px auto
color: $primary
.left,.right
width: 50% width: 50%
display: inline-block display: inline-block
vertical-align: top vertical-align: top
margin-bottom: 100px .left
span.year a.logo-link
width: 100% border-bottom: none
font-size: 2em
.archive-month
margin: 0 0 20px 0 margin: 0 0 20px 0
font-size: 1em
span.month
width: 100%
font-size: 1.5em
display: block display: block
a #logo
font-size: .8em width: 50px
font-weight: 400 border-bottom: none
.right
text-align: right
footer a.menu-link
background: $secondary background: $secondary
overflow: hidden margin-bottom: 4px
.inner padding: 3px
border-radius: 2px
display: inline-block
font-size: 0.8em
border-bottom: none
&:hover
background: $secondary
.container
z-index: 2
background: $white
line-height: 30px
font-weight: lighter
width: 100%
//padding 40px
color: $black
article
position: relative
width: 80% width: 80%
max-width: 964px height: 80%
max-width: 840px
//min-height 500px
background: $white
vertical-align: top
color: $black
margin: 0 auto margin: 0 auto
padding: 20px //.index, .page
color: $white //margin 30px
.index, .page
//Responsive padding: 0 0 15px 0
@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 img
width: 100%
margin: 0 auto
display: block display: block
@media only screen and (max-width: 480px)
#main
.wrapper
article.index
div
span
font-size: .64em
width: 100% width: 100%
div h1
font-size: 1.6em color: $primary
width: 100% p
#recent-links 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 a
font-size: 0.8em
font-weight: 400
//archive styling
.archive-item
padding: 15px 0 20px 0
span.year
font-size: 1.5em font-size: 1.5em
label font-weight: 500
font-size: 3em padding: 5px
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 display: block
color: $primary
.archive-month
display: inline-block
vertical-align: top
width: 30%
padding: 5px
span.month
color: $secondary
font-size: 1.5em
font-weight: 300
padding: 5px
display: block
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%
margin: 0 auto
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
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
// 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%