Compare commits
No commits in common. "945575a4d5d61bac15c5910475f44f18f2309894" and "f5bebc057e9d951565c9ec4862526931a4f3cf72" have entirely different histories.
945575a4d5
...
f5bebc057e
|
|
@ -1,38 +0,0 @@
|
||||||
import PuppeteerHTMLPDF from "puppeteer-html-pdf";
|
|
||||||
import { nanoid } from 'nanoid'
|
|
||||||
import fs from 'fs';
|
|
||||||
|
|
||||||
let config = {}
|
|
||||||
export default function (eleventyConfig, pluginOptions) {
|
|
||||||
config = pluginOptions;
|
|
||||||
eleventyConfig.addTransform("toPDF", transformPDF);
|
|
||||||
};
|
|
||||||
|
|
||||||
const transformPDF = async function(content) {
|
|
||||||
if (this.outputPath && this.outputPath.toLowerCase().endsWith('.pdf')) {
|
|
||||||
let htmlFile = `./${config.tempDir || "dist"}/${nanoid()}.html`;
|
|
||||||
let pdfFile = `./${config.tempDir || "dist"}/${nanoid()}.pdf`;
|
|
||||||
|
|
||||||
fs.writeFileSync(htmlFile, content);
|
|
||||||
|
|
||||||
const htmlPDF = new PuppeteerHTMLPDF();
|
|
||||||
const options = {
|
|
||||||
format: config.format || "A4",
|
|
||||||
margin: config.margin || {
|
|
||||||
top: "1cm",
|
|
||||||
right: "1.25cm",
|
|
||||||
bottom: "1cm",
|
|
||||||
left: "1.25cm",
|
|
||||||
},
|
|
||||||
path: pdfFile, // you can pass path to save the file
|
|
||||||
};
|
|
||||||
htmlPDF.setOptions(options);
|
|
||||||
|
|
||||||
const pdfContent = await htmlPDF.readFile(htmlFile, "utf8");
|
|
||||||
await htmlPDF.create(pdfContent);
|
|
||||||
let contents = fs.readFileSync(pdfFile, 'binary');
|
|
||||||
|
|
||||||
fs.unlinkSync(htmlFile); fs.unlinkSync(pdfFile);
|
|
||||||
return Buffer.from(contents,'binary');
|
|
||||||
} else return content;
|
|
||||||
};
|
|
||||||
|
|
@ -3,7 +3,6 @@ import browserslist from "browserslist";
|
||||||
import * as sass from "sass";
|
import * as sass from "sass";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { bundle, browserslistToTargets, composeVisitors, transform } from "lightningcss" ;
|
import { bundle, browserslistToTargets, composeVisitors, transform } from "lightningcss" ;
|
||||||
import eleventyPDF from "./_config/eleventy-plugin-pdf.js";
|
|
||||||
|
|
||||||
export default async function (eleventyConfig) {
|
export default async function (eleventyConfig) {
|
||||||
eleventyConfig.setUseGitIgnore(false);
|
eleventyConfig.setUseGitIgnore(false);
|
||||||
|
|
@ -11,7 +10,6 @@ export default async function (eleventyConfig) {
|
||||||
eleventyConfig.addPassthroughCopy({"./src/_includes/js/" : "/js"});
|
eleventyConfig.addPassthroughCopy({"./src/_includes/js/" : "/js"});
|
||||||
|
|
||||||
eleventyConfig.addLayoutAlias('base', 'layouts/base.html');
|
eleventyConfig.addLayoutAlias('base', 'layouts/base.html');
|
||||||
eleventyConfig.addLayoutAlias('pdf', 'layouts/pdf.html');
|
|
||||||
|
|
||||||
eleventyConfig.addCollection("sections", (collectionApi) => {
|
eleventyConfig.addCollection("sections", (collectionApi) => {
|
||||||
const sections = collectionApi.getFilteredByGlob("./src/pages/sections/**")
|
const sections = collectionApi.getFilteredByGlob("./src/pages/sections/**")
|
||||||
|
|
@ -31,8 +29,6 @@ export default async function (eleventyConfig) {
|
||||||
.sort((a, b) => a.data.startDate - b.data.startDate).reverse();
|
.sort((a, b) => a.data.startDate - b.data.startDate).reverse();
|
||||||
});
|
});
|
||||||
|
|
||||||
eleventyConfig.addPlugin(eleventyPDF);
|
|
||||||
|
|
||||||
eleventyConfig.addPassthroughCopy('src/favicon.ico')
|
eleventyConfig.addPassthroughCopy('src/favicon.ico')
|
||||||
|
|
||||||
// Recognize CSS as a "template language"
|
// Recognize CSS as a "template language"
|
||||||
|
|
|
||||||
1109
package-lock.json
generated
1109
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -15,8 +15,6 @@
|
||||||
"@11ty/eleventy": "^3.0.0",
|
"@11ty/eleventy": "^3.0.0",
|
||||||
"browserslist": "^4.24.4",
|
"browserslist": "^4.24.4",
|
||||||
"lightningcss": "^1.29.3",
|
"lightningcss": "^1.29.3",
|
||||||
"sass": "^1.87.0",
|
"sass": "^1.87.0"
|
||||||
"nanoid": "^5.1.5",
|
|
||||||
"puppeteer-html-pdf": "^4.0.8"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,109 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang={{ site.lang }} >
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>{{ title }}</title>
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="styles.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
{% block content %}
|
|
||||||
{{ content }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--accent-color: blue;
|
|
||||||
--font-body: Arial, sans-serif;
|
|
||||||
--font-display: 'Times New Roman', Times, serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
html {
|
|
||||||
font-family: var(--font-body, Arial, sans-serif);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*, ::before, ::after {
|
|
||||||
-webkit-box-sizing: border-box;
|
|
||||||
-moz-box-sizing: border-box;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
text-align:center;
|
|
||||||
font-family: var(--font-display, 'Times New Roman', Times, serif);
|
|
||||||
font-size: 2rem;
|
|
||||||
margin: 0;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
h2 {
|
|
||||||
color : var(--accent-color, blue);
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
ul {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
li::marker {
|
|
||||||
color: var(--accent-color, blue);
|
|
||||||
}
|
|
||||||
section {margin-bottom: 1.2rem;}
|
|
||||||
|
|
||||||
.justify-center {
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
.underline {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
.list-inline {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
gap: .8rem;
|
|
||||||
}
|
|
||||||
.list-inline li {
|
|
||||||
display: contents;
|
|
||||||
}
|
|
||||||
.list-inline li + li::before {
|
|
||||||
content: '|';
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
|
||||||
display: flex;
|
|
||||||
gap: .8rem;
|
|
||||||
margin-bottom: .6rem;
|
|
||||||
}
|
|
||||||
.title h2 {
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
.title hr {
|
|
||||||
align-self: center;
|
|
||||||
flex: 1 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
section ul {padding: 0;margin-left: 1.2rem;}
|
|
||||||
.subtitle {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(3, 1fr);
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
justify-items: center;
|
|
||||||
margin-inline: 1rem;
|
|
||||||
margin-bottom: .4rem;
|
|
||||||
}
|
|
||||||
.subtitle .timeSection { font-size: .9rem; }
|
|
||||||
.subtitle h3,
|
|
||||||
.subtitle p { margin: 0; }
|
|
||||||
.subtitle > :first-child {justify-self: start;}
|
|
||||||
.subtitle > :last-child {justify-self: end;}
|
|
||||||
.subtitle + ul {font-size: .9rem;}
|
|
||||||
.subtitle ~ .subtitle {margin-top: 1rem;}
|
|
||||||
</style>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
<section>
|
|
||||||
{% if section.data.showTitle != false %}
|
|
||||||
<div class="title">
|
|
||||||
<h2>
|
|
||||||
{% if section.data.displayedTitle %}
|
|
||||||
{{ section.data.displayedTitle }}
|
|
||||||
{% else %}
|
|
||||||
{{ section.data.title }}
|
|
||||||
{% endif %}
|
|
||||||
</h2>
|
|
||||||
<hr>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% for item in items %}
|
|
||||||
<div class="subtitle">
|
|
||||||
<h3>{{ item.data.title }}</h3>
|
|
||||||
<p class="underline">
|
|
||||||
<strong>{{ item.data.role }}</strong>
|
|
||||||
</p>
|
|
||||||
{% if item.data.dates %}
|
|
||||||
<div class="timeSection">
|
|
||||||
<span>{{ item.data.location }}</span>
|
|
||||||
<strong>{{ item.data.dates.start }} - {{ item.data.dates.end }}</strong>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>{{ item.data.description }}</li>
|
|
||||||
</ul>
|
|
||||||
{% endfor %}
|
|
||||||
</section>
|
|
||||||
|
|
@ -1,12 +1,8 @@
|
||||||
---
|
---
|
||||||
title: Artionet - Web Agency
|
title: Artionet - Web Agency
|
||||||
role: Stagiaire
|
|
||||||
description: Stage de 4ème année de CFC, développement web
|
description: Stage de 4ème année de CFC, développement web
|
||||||
location: Delémont
|
location: Delémont
|
||||||
link: https://www.artionet.ch
|
link: https://www.artionet.ch
|
||||||
dates:
|
|
||||||
start: 2021
|
|
||||||
end: 2022
|
|
||||||
startDate: 2021
|
startDate: 2021
|
||||||
endDate: 2022
|
endDate: 2022
|
||||||
---
|
---
|
||||||
|
|
@ -1,12 +1,8 @@
|
||||||
---
|
---
|
||||||
title: Artionet - Web Agency
|
title: Artionet - Web Agency
|
||||||
role: Développeur
|
|
||||||
description: Développeur Front-End et Support Client
|
description: Développeur Front-End et Support Client
|
||||||
location: Delémont
|
location: Delémont
|
||||||
link: https://www.artionet.ch
|
link: https://www.artionet.ch
|
||||||
dates:
|
|
||||||
start: 2022
|
|
||||||
end: Present
|
|
||||||
startDate: 2022
|
startDate: 2022
|
||||||
endDate: 2024
|
endDate: 2024
|
||||||
---
|
---
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
---
|
---
|
||||||
title: Ecole des métiers Technique
|
title: Ecole des métiers Technique
|
||||||
role: Etudiant
|
|
||||||
description: CFC d'informaticien d'entreprise
|
description: CFC d'informaticien d'entreprise
|
||||||
location: Porrentruy
|
location: Porrentruy
|
||||||
dates:
|
|
||||||
start: 2018
|
|
||||||
end: 2022
|
|
||||||
startDate: 2018
|
startDate: 2018
|
||||||
endDate: 2022
|
endDate: 2022
|
||||||
---
|
---
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
---
|
---
|
||||||
title: Téléchargement
|
title: Téléchargement
|
||||||
showTitle: false
|
showTitle: false
|
||||||
excludeFromPdf: true
|
|
||||||
order: 4
|
order: 4
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
---
|
---
|
||||||
title: Expériences
|
title: Expériences
|
||||||
displayedTitle: Mes expériences
|
displayedTitle: Mes expériences
|
||||||
collection: experiences
|
|
||||||
order: 3
|
order: 3
|
||||||
---
|
---
|
||||||
|
|
||||||
{% assign experiences = collections[collection] %}
|
{% assign experiences = collections.experiences %}
|
||||||
{% render 'partials/components/timeline', timeline: experiences %}
|
{% render 'partials/components/timeline', timeline: experiences %}
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
title: A propos
|
title: A propos
|
||||||
order: 0
|
order: 0
|
||||||
template: 'hero'
|
template: 'hero'
|
||||||
excludeFromPdf: true
|
|
||||||
eleventyComputed:
|
eleventyComputed:
|
||||||
description: "{{ author.about }}"
|
description: "{{ author.about }}"
|
||||||
displayedTitle: "Moi c'est {{ author.firstName }}<br>Et je suis {{ author.occupation }}"
|
displayedTitle: "Moi c'est {{ author.firstName }}<br>Et je suis {{ author.occupation }}"
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
---
|
---
|
||||||
title: Projets
|
title: Projets
|
||||||
displayedTitle: Mes projets
|
displayedTitle: Mes projets
|
||||||
collection: projects
|
|
||||||
order: 2
|
order: 2
|
||||||
---
|
---
|
||||||
|
|
||||||
{% assign projects = collections[collection] %}
|
{% assign projects = collections.projects %}
|
||||||
{% include 'partials/components/project-grid' %}
|
{% include 'partials/components/project-grid' %}
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
---
|
|
||||||
layout: pdf
|
|
||||||
permalink: "pdf.pdf"
|
|
||||||
eleventyComputed:
|
|
||||||
title: "{{author.firstName}} {{author.name}}, {{author.occupation}}"
|
|
||||||
links:
|
|
||||||
- value: "thomas@amstutz.it"
|
|
||||||
- type: "link"
|
|
||||||
value: "github.com/TheThomaas"
|
|
||||||
- value: "123 123 12 12"
|
|
||||||
---
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h1>{{ title }}</h1>
|
|
||||||
<ul class="list-inline justify-center">
|
|
||||||
{% for item in links %}
|
|
||||||
{% if item.type == "link" %}
|
|
||||||
<li><a href="{{item.value}}">{{item.value}}</a></li>
|
|
||||||
{% else %}
|
|
||||||
<li>{{item.value}}</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
The time is {{ "now" | date: "%Y-%m-%d %H:%M" }}
|
|
||||||
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{% for section in collections.sections %}
|
|
||||||
{% if section.data.excludeFromPdf != true %}
|
|
||||||
{% assign items = collections[section.data.collection] %}
|
|
||||||
{% include 'partials/components/pdf/section' %}
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
Loading…
Reference in a new issue