parent
19a4579134
commit
560ba036ca
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"/spritemap.js": "/spritemap.js?id=2dda73ecee3bb668b395026efda6524c",
|
||||||
|
"/public/css/styles.css": "/public/css/styles.css?id=c80a1181f87f3c3ef715844b545559f4"
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
@import
|
||||||
|
|
||||||
|
'@tiny-components/plain-ui/src/scss/plain-ui';
|
@ -0,0 +1,43 @@
|
|||||||
|
<!doctype html>
|
||||||
|
|
||||||
|
<html lang="{{ it.settings.data.default_language }}">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>
|
||||||
|
{{ it.page.data.title }} | {{ it.settings.data.project_name }}
|
||||||
|
</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="/static/css/styles.css" rel="stylesheet" type="text/css">
|
||||||
|
</head>
|
||||||
|
<body class="site-body {{ it.templateClass(it.page) }}">
|
||||||
|
<header class="site-header">
|
||||||
|
|
||||||
|
<div class="bar">
|
||||||
|
<div class="bar__start">
|
||||||
|
{{# if (isHome(it.page)) { }}
|
||||||
|
<h1 class="site-header__title">
|
||||||
|
{{ it.page.data.title }}
|
||||||
|
</h1>
|
||||||
|
{{# } else { }}
|
||||||
|
<a class="site-header__title">
|
||||||
|
{{ it.page.data.title }}
|
||||||
|
</a>
|
||||||
|
{{# } }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main class="site-main">
|
||||||
|
{{! it.body }}
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="site-footer">
|
||||||
|
<div class="site-footer__copyright">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1,46 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en_EN">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title>
|
|
||||||
{{ page.data.title }}
|
|
||||||
</title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
|
|
||||||
<link href="/css/styles.css" rel="stylesheet" type="text/css">
|
|
||||||
|
|
||||||
{% block head %}{% endblock %}
|
|
||||||
</head>
|
|
||||||
<body class="site-body page-{ siteClass(page) (page.data.slug) ? slug : 'home' }">
|
|
||||||
<header class="site-header">
|
|
||||||
{% block siteHeader %}
|
|
||||||
<h1 class="site-header__title">
|
|
||||||
{{ page.data.title }}
|
|
||||||
{{ options.data.title }}
|
|
||||||
</h1>
|
|
||||||
{% endblock %}
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main class="site-main">
|
|
||||||
{% block siteMain %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<footer class="site-footer">
|
|
||||||
{% block siteFooter %}
|
|
||||||
<div class="">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
<div class="site-footer__copyright">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
{% block script %}{% endblock %}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||||||
|
{% layout('layout') %}
|
||||||
|
|
||||||
|
{{# const posts = await it.injectStore('post') }}
|
||||||
|
|
||||||
|
{{# if posts.data.length > 0 }}
|
||||||
|
{{# posts.data.forEach((post) => { }}
|
||||||
|
{{ post.title }}
|
||||||
|
{{ marked.parse(page.data.content) }}
|
||||||
|
{{# }) }}
|
||||||
|
{{# } else { }}
|
||||||
|
|
||||||
|
{{# } }}
|
@ -1,13 +0,0 @@
|
|||||||
{% layout 'layout.liquid' %}
|
|
||||||
|
|
||||||
{% block siteMain %}
|
|
||||||
<div class="container">
|
|
||||||
<div class="grid">
|
|
||||||
<div class="col-12">
|
|
||||||
<div class="content">
|
|
||||||
{ marked.parse(page.data.content) }
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@ -1,13 +1,11 @@
|
|||||||
{% layout 'layout.liquid' %}
|
{{# layout('layout') }}
|
||||||
|
|
||||||
{% block siteMain %}
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
{{ page.data.content }}
|
{{! it.parseMarkdown(it.page.data.content) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
@ -0,0 +1,84 @@
|
|||||||
|
const mix = require('laravel-mix')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
require('laravel-mix-purgecss')
|
||||||
|
|
||||||
|
// plugins
|
||||||
|
const SvgSpritemapPlugin = require('svg-spritemap-webpack-plugin')
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Mix Asset Management
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Mix provides a clean, fluent API for defining some Webpack build steps
|
||||||
|
| for your Laravel applications. By default, we are compiling the CSS
|
||||||
|
| file for the application as well as bundling up all the JS files.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
mix.webpackConfig({
|
||||||
|
module: {
|
||||||
|
rules: [{
|
||||||
|
test: /\.riot$/,
|
||||||
|
use: [{
|
||||||
|
loader: '@riotjs/webpack-loader',
|
||||||
|
options: {
|
||||||
|
hot: false
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
]},
|
||||||
|
plugins: [
|
||||||
|
new SvgSpritemapPlugin([
|
||||||
|
'./node_modules/@tiny-components/plain-ui/src/icons/mono-icons/svg/*.svg',
|
||||||
|
'./icons/*.svg'
|
||||||
|
], {
|
||||||
|
output: {
|
||||||
|
filename: 'public/symbol-defs.svg',
|
||||||
|
chunk: {
|
||||||
|
keep: true
|
||||||
|
},
|
||||||
|
svgo: {
|
||||||
|
plugins: [{
|
||||||
|
name: 'convertStyleToAttrs',
|
||||||
|
active: true
|
||||||
|
},{
|
||||||
|
name: 'removeStyleElement',
|
||||||
|
active: true
|
||||||
|
}, {
|
||||||
|
name: 'removeAttrs',
|
||||||
|
params: {
|
||||||
|
attrs: 'fill'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sprite: {
|
||||||
|
prefix: 'icon-'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
mix
|
||||||
|
.setPublicPath('../../')
|
||||||
|
//.js('js/app.js', 'public/js')
|
||||||
|
.sass('scss/styles.scss', 'public/css')
|
||||||
|
.purgeCss({
|
||||||
|
extend: {
|
||||||
|
content: [
|
||||||
|
path.join(__dirname, 'js/**/*.riot'),
|
||||||
|
path.join(__dirname, 'views/*.liquid')
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.options({
|
||||||
|
terser: {
|
||||||
|
extractComments: false,
|
||||||
|
},
|
||||||
|
processCssUrls: false
|
||||||
|
})
|
||||||
|
.copyDirectory('node_modules/@tiny-components/plain-ui/src/fonts/**', '../../public/css')
|
||||||
|
.version()
|
@ -0,0 +1,14 @@
|
|||||||
|
import slugify from 'slugify'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default async function injectStore(name) {
|
||||||
|
const StoreClass = await import('./../stores/' + name + '.js')
|
||||||
|
const store = new StoreClass.default()
|
||||||
|
|
||||||
|
return await store.find()
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
import slugify from 'slugify'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default function isHome(entity) {
|
||||||
|
|
||||||
|
let result = false
|
||||||
|
|
||||||
|
if (entity.data && entity.data.permalink && entity.data.permalink === "/") {
|
||||||
|
result = true
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import { marked } from 'marked'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default function parseMarkdown(value) {
|
||||||
|
return marked.parse(value)
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
import slugify from 'slugify'
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
export default function templateClass(entity, prefix = 'page') {
|
||||||
|
if (entity.data && entity.data.template) {
|
||||||
|
prefix += '-' + entity.data.template
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefix
|
||||||
|
}
|
@ -0,0 +1,117 @@
|
|||||||
|
/**
|
||||||
|
* function similar to blade asset
|
||||||
|
*
|
||||||
|
* @param $path
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function asset($path, $prefix = '/public')
|
||||||
|
{
|
||||||
|
// get flight
|
||||||
|
$app = Flight::app();
|
||||||
|
|
||||||
|
// getting basePath
|
||||||
|
$basePath = $app->get('basePath');
|
||||||
|
|
||||||
|
// path to mix-manifest
|
||||||
|
$file = $app->get('basePath').'mix-manifest.json';
|
||||||
|
|
||||||
|
if (file_exists($file)) {
|
||||||
|
$manifest = file_get_contents($file);
|
||||||
|
$files = json_decode($manifest, true);
|
||||||
|
|
||||||
|
if (isset($files[$prefix.$path])) {
|
||||||
|
$path = str_replace($prefix, '', $files[$prefix.$path]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getting name of view as slug
|
||||||
|
*
|
||||||
|
* @param array $page
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function viewName(array $page)
|
||||||
|
{
|
||||||
|
$slugify = new \Cocur\Slugify\Slugify();
|
||||||
|
return $slugify->slugify($page['data']['view']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getting name of view as slug
|
||||||
|
*
|
||||||
|
* @param array $page
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function canonical()
|
||||||
|
{
|
||||||
|
if (isset($_SERVER['HTTPS'])) {
|
||||||
|
$canoncial = 'https';
|
||||||
|
} else {
|
||||||
|
$canoncial = 'http';
|
||||||
|
}
|
||||||
|
|
||||||
|
$canoncial .= '://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
|
||||||
|
|
||||||
|
return $canoncial;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getting title for head
|
||||||
|
*
|
||||||
|
* @param array $page
|
||||||
|
* @param array $site
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function title($page, $site)
|
||||||
|
{
|
||||||
|
$title = [];
|
||||||
|
|
||||||
|
if (isset($site['data']['title'])) {
|
||||||
|
$title[] = $site['data']['title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// if not homepage set page title first
|
||||||
|
if ($page['data']['slug']) {
|
||||||
|
array_unshift($title, $page['data']['title']);
|
||||||
|
} else {
|
||||||
|
$title[] = $page['data']['title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return join(' | ', $title);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* getting url for assets of directus api
|
||||||
|
*
|
||||||
|
* @param string string
|
||||||
|
* @param array array
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function assetsUrl(string $id, array $options = NULL)
|
||||||
|
{
|
||||||
|
$query = NULL;
|
||||||
|
|
||||||
|
if ($options) {
|
||||||
|
$query = '?'.http_build_query($options);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $_ENV['DIRECTUS_API_URL'].'/assets/'.$id.$query;
|
||||||
|
}
|
||||||
|
|
||||||
|
function styles($values) {
|
||||||
|
|
||||||
|
$result = '';
|
||||||
|
|
||||||
|
if ($values && is_array($values)) {
|
||||||
|
$result = implode(' ', $values);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import DirectusAbstractStore from './DirectusAbstract.js'
|
import DirectusAbstractStore from './directusAbstract.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pages from Directus
|
* Pages from Directus
|
@ -1,4 +1,4 @@
|
|||||||
import DirectusAbstractStore from './DirectusAbstract.js'
|
import DirectusAbstractStore from './directusAbstract.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings
|
* Settings
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,13 @@
|
|||||||
|
(self["webpackChunkfrontend"] = self["webpackChunkfrontend"] || []).push([["spritemap"],{
|
||||||
|
|
||||||
|
/***/ "?c20d":
|
||||||
|
/*!******************************!*\
|
||||||
|
!*** spritemap-dummy-module ***!
|
||||||
|
\******************************/
|
||||||
|
/***/ (() => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
}]);
|
Loading…
Reference in new issue