feat: reworked the layout system

feat: css now inline to improve performance
feat: now using 11ty 1.0.0-beta to use addGlobalData
This commit is contained in:
Laureηt 2021-10-10 18:29:22 +02:00
parent 0c434960b5
commit fa485e220d
No known key found for this signature in database
GPG key ID: D88C6B294FD40994
12 changed files with 503 additions and 612 deletions

View file

@ -11,6 +11,7 @@ const markdownLib = markdownIt(options).use(markdownItAttrs);
module.exports = function (eleventyConfig) { module.exports = function (eleventyConfig) {
eleventyConfig.addGlobalData("username", "Laureηt");
eleventyConfig.addPlugin(pluginNavigation); eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.setLibrary("md", markdownLib); eleventyConfig.setLibrary("md", markdownLib);
eleventyConfig.addWatchTarget("./src/scss/"); eleventyConfig.addWatchTarget("./src/scss/");

2
.gitignore vendored
View file

@ -1,5 +1,7 @@
node_modules/ node_modules/
_site/ _site/
content/ content/
src/_includes/css
*.log *.log

View file

@ -4,15 +4,15 @@
"author": "Laureηt <laurentfainsin@protonmail.com>", "author": "Laureηt <laurentfainsin@protonmail.com>",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"watch:sass": "sass --no-source-map --watch src/scss:_site/css", "watch:sass": "sass --no-source-map --watch src/scss:src/_includes/css",
"watch:eleventy": "eleventy --serve", "watch:eleventy": "eleventy --serve",
"build:sass": "sass --no-source-map --style compressed src/scss:_site/css", "build:sass": "sass --no-source-map --style compressed src/scss:src/_includes/css",
"build:eleventy": "ELEVENTY_ENV=prod eleventy", "build:eleventy": "ELEVENTY_ENV=prod eleventy",
"start": "npm-run-all build:sass --parallel watch:*", "start": "npm-run-all build:sass --parallel watch:*",
"build": "npm-run-all build:sass build:eleventy" "build": "npm-run-all build:sass build:eleventy"
}, },
"dependencies": { "dependencies": {
"@11ty/eleventy": "^0.12.1", "@11ty/eleventy": "^1.0.0-beta.2",
"@11ty/eleventy-navigation": "^0.2.0", "@11ty/eleventy-navigation": "^0.2.0",
"chaffle": "^2.1.0", "chaffle": "^2.1.0",
"html-minifier": "^4.0.0", "html-minifier": "^4.0.0",

View file

@ -1,25 +0,0 @@
<script>
var elm_mouseover = document.querySelectorAll('[data-chaffle]');
var elm_onload = document.querySelectorAll('[data-chaffle-onLoad]');
Array
.prototype
.forEach
.call(elm_mouseover, function (el) {
var chaffle = new Chaffle(el)
el.addEventListener('mouseover', function () {
chaffle.init();
});
});
Array
.prototype
.forEach
.call(elm_onload, function (el) {
var chaffle = new Chaffle(el)
chaffle.init();
setInterval(function () {
chaffle.init();
}, 10000)
});
</script>

View file

@ -1,10 +1,8 @@
--- {% extends "layout.njk" %}
layout: layout.njk
---
{% block head %} {% block style %}
<link rel="stylesheet" href="{{ '/css/eportfolio.css' | url }}"> {% include "css/eportfolio.css" %}
{% endblock head %} {% endblock style %}
{% block precontent %} {% block precontent %}
<nav class="11ty-nav" role="navigation"> <nav class="11ty-nav" role="navigation">

View file

@ -1,4 +0,0 @@
<footer role="contentinfo">
&copy; {% year %}
{{ username }}
</footer>

View file

@ -1,7 +0,0 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ username }}</title>
<link rel="stylesheet" href="{{ '/css/style.css' | url }}">
<link rel="stylesheet" href="{{ '/css/anim.css' | url }}">
<link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.png' | url }}">
<script src="{{ '/javascript/chaffle.min.js' | url }}"></script>

View file

@ -1,4 +0,0 @@
<header role="banner">
<span data-chaffle-onload="" data-chaffle="en">{{ username }}</span>
<i class="blink">_</i>
</header>

View file

@ -1,26 +1,69 @@
---
username: Laureηt
---
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
{% include "head.njk" %} <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.png' | url }}">
<script src="{{ '/javascript/chaffle.min.js' | url }}"></script>
<title>{{ username }}</title>
{% block head %}{% endblock head %} {% block head %}{% endblock head %}
<style>
{% include "css/style.css" %}
{% include "css/anim.css" %}
{% block style %}
{% endblock style %}
</style>
</head> </head>
<body> <body>
{% include "header.njk" %} <header role="banner">
<div id="username">
<span data-chaffle-onload="" data-chaffle="en">{{ username }}</span>
<i class="blink">_</i>
</div>
{% block header %}{% endblock header %}
</header>
{% block precontent %}{% endblock precontent %} {% block precontent %}{% endblock precontent %}
<main role="main"> <main role="main">
{% block content %}{% endblock content %}
{{ content | safe }} {{ content | safe }}
</main> </main>
{% block postcontent %}{% endblock postcontent %} {% block postcontent %}{% endblock postcontent %}
{% include "footer.njk" %}
<footer role="contentinfo">
&copy; {% year %}
{{ username }}
</footer>
{% block foot %}{% endblock foot %} {% block foot %}{% endblock foot %}
{% include "chaffle.njk" %} <script>
var elm_mouseover = document.querySelectorAll('[data-chaffle]');
var elm_onload = document.querySelectorAll('[data-chaffle-onLoad]');
Array
.prototype
.forEach
.call(elm_mouseover, function (el) {
var chaffle = new Chaffle(el)
el.addEventListener('mouseover', function () {
chaffle.init();
});
});
Array
.prototype
.forEach
.call(elm_onload, function (el) {
var chaffle = new Chaffle(el)
chaffle.init();
setInterval(function () {
chaffle.init();
}, 10000)
});
</script>
</body> </body>
</html> </html>

View file

@ -1,5 +1,4 @@
--- ---
username: Laureηt
pagination: pagination:
data: resumes data: resumes
size: 1 size: 1
@ -8,39 +7,30 @@ pagination:
permalink: "resume/{{ resume.locale }}/index.html" permalink: "resume/{{ resume.locale }}/index.html"
--- ---
<!DOCTYPE html> {% extends "layout.njk" %}
<html lang="{{ resume.locale }}">
<head> {% block head %}
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ username }}</title>
<link rel="stylesheet" href="{{ '/css/style.css' | url }}">
<link rel="stylesheet" href="{{ '/css/resume.css' | url }}">
<link rel="stylesheet" href="{{ '/css/anim.css' | url }}">
<link rel="shortcut icon" type="image/x-icon" href="{{ '/favicon.png' | url }}">
<script src="{{ '/javascript/chaffle.min.js' | url }}"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-awesome@1.1.7/css/fork-awesome.min.css" integrity="sha256-gsmEoJAws/Kd3CjuOQzLie5Q3yshhvmo7YNtBG7aaEY=" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-awesome@1.1.7/css/fork-awesome.min.css" integrity="sha256-gsmEoJAws/Kd3CjuOQzLie5Q3yshhvmo7YNtBG7aaEY=" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.5.0/css/flag-icon.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.5.0/css/flag-icon.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/devicon/2.6/devicon.min.css" rel="stylesheet"> <link href="https://cdnjs.cloudflare.com/ajax/libs/devicon/2.6/devicon.min.css" rel="stylesheet">
<base target="_blank"> <base target="_blank">
</head> {% endblock head %}
<body> {% block style %}
{% include "css/resume.css" %}
<header style="position: relative;"> {% endblock style %}
<span data-chaffle-onload="" data-chaffle="en">{{ username }}</span>
<span class="blink" style="display:inline;">_</span>
{% block header %}
{% for pageKey in pagination.pages %} {% for pageKey in pagination.pages %}
{% if pageKey.locale != resume.locale %} {% if pageKey.locale != resume.locale %}
<a style="right: 0px; position: absolute;" href="{{ pagination.hrefs[loop.index-1] | url }}" target="_self"> <a href="{{ pagination.hrefs[loop.index-1] | url }}" target="_self">
<span class="{{ pageKey.flag_icon }}"></span><span style="text-transform:uppercase;">{{ pageKey.locale }}</span> <span class="{{ pageKey.flag_icon }}"></span><span style="text-transform:uppercase;">{{ pageKey.locale }}</span>
</a> </a>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</header> {% endblock header %}
{% block content %}
<div class="row"> <div class="row">
<div class="col-1"> <div class="col-1">
@ -199,42 +189,11 @@ permalink: "resume/{{ resume.locale }}/index.html"
</div> </div>
</div> </div>
{% endblock content %}
<div class="btn-back"> {% block postcontent %}
<span>&laquo;</span> <nav id="btn-back" role="navigation">
<a href="{{ '/' | url }}" target="_self">{{ resume.go_back }}</a> <i>&laquo;</i>
</div> <a href="{{ '/' | url }}">Go back</a>
</nav>
<footer> {% endblock postcontent %}
&copy; {% year %}
{{ username }}
</footer>
<script>
var elm_mouseover = document.querySelectorAll('[data-chaffle]');
var elm_onload = document.querySelectorAll('[data-chaffle-onLoad]');
Array
.prototype
.forEach
.call(elm_mouseover, function (el) {
var chaffle = new Chaffle(el)
el.addEventListener('mouseover', function () {
chaffle.init();
});
});
Array
.prototype
.forEach
.call(elm_onload, function (el) {
var chaffle = new Chaffle(el)
chaffle.init();
setInterval(function () {
chaffle.init();
}, 10000)
});
</script>
</body>
</html>

View file

@ -3,6 +3,11 @@ body {
width: 80rem; width: 80rem;
} }
header {
display: flex;
justify-content: space-between;
}
h1, h1,
h2 { h2 {
height: auto; height: auto;

619
yarn.lock

File diff suppressed because it is too large Load diff