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
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
border-bottom: 1px $tertiary solid background: none
#main svg.icons
width: 100% width: 25px
height: 100% fill: $white
header
background: $primary background: $primary
header height: 90%
width: 100%
height: 100%
background-size: cover
background: $black
border-top: 2px $tertiary solid
#cover
position: relative
height: 100%
width: 100% width: 100%
.that-logo border-top: $white 3px solid
width: 300px nav
height: 300px width: 97%
display: block margin: 10px auto
position: absolute color: $primary
z-index: 1000 .left,.right
margin: -50px 0 0 -50px width: 50%
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 display: inline-block
vertical-align: top vertical-align: top
width: 15% .left
font-family: $monoType a.logo-link
font-size: .8em border-bottom: none
div margin: 0 0 20px 0
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 display: block
margin: 60px 0 20px 15% #logo
article.page width: 50px
width: 100% border-bottom: none
#title .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 background: $secondary
color: $tertiary
padding: 40px
font-size: 3em
font-weight: 800
#page_desc
padding: 40px
color: $secondary .container
font-size: 1.5em z-index: 2
img background: $white
width: 90% 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 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
vertical-align: top
margin-bottom: 100px
span.year span.year
width: 100% font-size: 1.5em
font-size: 2em font-weight: 500
padding: 5px
display: block
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
section
padding: 0 0 20px 0
background: $primary
a a
font-size: .8em color: $white
.index-lists, .page-title
max-width: 840px
span
font-size: 2em
color: $secondary
font-weight: 400 font-weight: 400
footer
background: $secondary
overflow: hidden
.inner
width: 80% width: 80%
max-width: 964px
margin: 0 auto margin: 0 auto
padding: 20px padding: 20px 0 0 0
.recent, .featured
display: inline-block
width: 50%
vertical-align: top
label
background: $black
color: $white 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 footer
.wrapper background: $white
article.index padding: 10px
div color: $primary
span font-size: 0.8em
font-size: .64em font-weight: 600
width: 100% height: 100px
div .inner
font-size: 1.6em margin: 20px auto
width: 100% width: 80%
#recent-links max-width: 840px
a 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 color: $secondary
font-size: 1.2em
img
width: 100%
margin: 0 auto
display: block
// 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