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/",
"default_bg": "/assets/images/global/default-bg.jpg",
"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>",
"bucket": [{ "item": "one" }, { "item": "two" }, { "item": "three" }],
"tag_list": [

View file

@ -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",

View file

@ -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"

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 %}
{{ title }}

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
{% 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 %}

View file

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

View file

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

View file

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

View file

@ -1,184 +1,226 @@
html, body
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
html
margin: 0
padding: 0
width: 100%
height: 100%
overflow: hidden
font: 400 1.2em/1.4em $baseType
body
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
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
#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
.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
article.index
padding: 20px
div
span
color: #fff
//.index, .page
//margin 30px
.index, .page
padding: 0 0 15px 0
img
display: block
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
padding: 15px 0 20px 0
span.year
font-size: 1.5em
font-weight: 500
padding: 5px
display: block
color: $primary
.archive-month
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
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
display: block
article#archive
.archive-item
width: 50%
display: inline-block
vertical-align: top
margin-bottom: 100px
span.year
width: 100%
font-size: 2em
.archive-month
margin: 0 0 20px 0
font-size: 1em
width: 30%
padding: 5px
span.month
width: 100%
font-size: 1.5em
display: block
a
font-size: .8em
font-weight: 400
footer
background: $secondary
overflow: hidden
.inner
width: 80%
max-width: 964px
margin: 0 auto
padding: 20px
color: $white
//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
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%