removed hardcoded theme paths in templates

develop
Are0h 3 years ago
parent f58c099721
commit dbe74e13ca

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

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

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

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

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

@ -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 %}

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

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

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

@ -1,184 +1,226 @@
html, body html
font: 400 1em $baseType margin: 0
padding: 0
width: 100%
height: 100% height: 100%
overflow: hidden
font: 400 1.2em/1.4em $baseType
body 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 a
color: $primary
text-decoration: none text-decoration: none
color: $tertiary border-bottom: 1px solid $highlight
border-bottom: 1px $secondary solid //@include object-transitions(.2s)
&:hover &:hover
color: $secondary border-bottom: 1px solid $secondary
border-bottom: 1px $tertiary solid
#main code
width: 100% background: $black
height: 100% 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 background: $primary
header height: 90%
width: 100% width: 100%
height: 100% border-top: $white 3px solid
background-size: cover nav
background: $black width: 97%
border-top: 2px $tertiary solid margin: 10px auto
#cover color: $primary
position: relative .left,.right
height: 100% width: 50%
width: 100% display: inline-block
.that-logo vertical-align: top
width: 300px .left
height: 300px a.logo-link
border-bottom: none
margin: 0 0 20px 0
display: block display: block
position: absolute #logo
z-index: 1000 width: 50px
margin: -50px 0 0 -50px border-bottom: none
cursor: pointer .right
.wrapper text-align: right
width: 100% a.menu-link
max-width: 1024px background: $secondary
min-height: 400px margin-bottom: 4px
margin: 0 auto padding: 3px
article.index border-radius: 2px
padding: 20px display: inline-block
div font-size: 0.8em
span border-bottom: none
color: #fff &:hover
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 background: $secondary
color: $tertiary
padding: 40px
font-size: 3em
font-weight: 800 .container
z-index: 2
#page_desc background: $white
padding: 40px line-height: 30px
color: $secondary font-weight: lighter
font-size: 1.5em width: 100%
img //padding 40px
width: 90% color: $black
margin: 0 auto 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 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 .archive-item
width: 50% padding: 15px 0 20px 0
display: inline-block span.year
vertical-align: top font-size: 1.5em
margin-bottom: 100px font-weight: 500
span.year padding: 5px
width: 100% display: block
font-size: 2em color: $primary
.archive-month .archive-month
margin: 0 0 20px 0 display: inline-block
font-size: 1em vertical-align: top
width: 30%
padding: 5px
span.month span.month
width: 100% color: $secondary
font-size: 1.5em font-size: 1.5em
font-weight: 300
padding: 5px
display: block display: block
a section
font-size: .8em padding: 0 0 20px 0
font-weight: 400 background: $primary
a
color: $white
footer .index-lists, .page-title
background: $secondary max-width: 840px
overflow: hidden span
.inner font-size: 2em
color: $secondary
font-weight: 400
width: 80% width: 80%
max-width: 964px
margin: 0 auto margin: 0 auto
padding: 20px padding: 20px 0 0 0
color: $white .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
// 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%
Loading…
Cancel
Save