Compare commits
3 commits
0d41066292
...
48c232efd0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48c232efd0 | ||
|
|
e3db7301f3 | ||
|
|
9fd9dbc14a |
|
|
@ -3,27 +3,34 @@ import { nanoid } from 'nanoid'
|
|||
import fs from 'fs';
|
||||
|
||||
let config = {}
|
||||
export default function (eleventyConfig, pluginOptions) {
|
||||
config = pluginOptions;
|
||||
export default function (eleventyConfig, pluginOptions = {}) {
|
||||
config = Object.assign({
|
||||
// Plugin defaults
|
||||
tempDir: "dist", // Directory where the temporary files are created
|
||||
debug: false, // Keep the generated temporary html file for debugging
|
||||
format: "A4", // Default pdf format
|
||||
margin: { // PDF file margins
|
||||
top: "1cm",
|
||||
right: "1.25cm",
|
||||
bottom: "1cm",
|
||||
left: "1.25cm",
|
||||
}
|
||||
}, 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`;
|
||||
let tempFileName = config.debug ? this.page.fileSlug : nanoid();
|
||||
let htmlFile = `./${config.tempDir}/${tempFileName}.html`;
|
||||
let pdfFile = `./${config.tempDir}/${tempFileName}.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",
|
||||
},
|
||||
format: config.format,
|
||||
margin: config.margin,
|
||||
path: pdfFile, // you can pass path to save the file
|
||||
};
|
||||
htmlPDF.setOptions(options);
|
||||
|
|
@ -32,7 +39,9 @@ const transformPDF = async function(content) {
|
|||
await htmlPDF.create(pdfContent);
|
||||
let contents = fs.readFileSync(pdfFile, 'binary');
|
||||
|
||||
fs.unlinkSync(htmlFile); fs.unlinkSync(pdfFile);
|
||||
if (!config.debug) {
|
||||
fs.unlinkSync(htmlFile); fs.unlinkSync(pdfFile);
|
||||
}
|
||||
return Buffer.from(contents,'binary');
|
||||
} else return content;
|
||||
};
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
{% include "css/reset.css" %}
|
||||
{% include "css/theme.css" %}
|
||||
{% include "css/variables.css" %}
|
||||
{% include "css/utilities.css" %}
|
||||
{% include "css/main.css" %}
|
||||
|
||||
{% include "css/components/button.css" %}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,6 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
<ul>
|
||||
<li>{{ item.data.description }}</li>
|
||||
</ul>
|
||||
{{ item.templateContent }}
|
||||
{% endfor %}
|
||||
</section>
|
||||
|
|
@ -12,100 +12,6 @@
|
|||
fill: currentColor;
|
||||
}
|
||||
|
||||
/* Utilities */
|
||||
.wrapper,
|
||||
.wrapper-full {
|
||||
grid-template-columns: 1fr min(
|
||||
var(--wrapper-max-length, var(--line-length)),
|
||||
100% - var(--wrapper-gap, var(--gutter)) * 2
|
||||
) 1fr;
|
||||
grid-column-gap: var(--wrapper-gap, var(--gutter));
|
||||
display: grid;
|
||||
}
|
||||
.wrapper > *,
|
||||
.wrapper-full > * {
|
||||
grid-column: 2;
|
||||
}
|
||||
.wrapper-full {
|
||||
grid-template-columns: 1fr min(
|
||||
var(--wrapper-max-length, var(--line-length-large)),
|
||||
100% - var(--wrapper-gap, var(--gutter)) * 2
|
||||
) 1fr;
|
||||
}
|
||||
.full-bleed {
|
||||
inline-size: 100%;
|
||||
padding: var(--padding-block, 1rem) var(--padding-inline, 2rem);
|
||||
background-color: var(--background-color, none);
|
||||
grid-column: 1/-1;
|
||||
}
|
||||
.flex {
|
||||
display: inline-flex;
|
||||
}
|
||||
.flex-col {
|
||||
flex-direction: column;
|
||||
}
|
||||
.justify-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
.justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
.items-center {
|
||||
align-items: center;
|
||||
}
|
||||
.sr-only {
|
||||
clip: rect(0, 0, 0, 0) !important;
|
||||
white-space: nowrap !important;
|
||||
border: 0 !important;
|
||||
block-size: 1px !important;
|
||||
inline-size: 1px !important;
|
||||
margin: -1px !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
.invisible {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
.list-inline {
|
||||
margin-left: calc(var(--item-gap, 1ch) * 3 * -1);
|
||||
clip-path: inset(0 0 0 calc(var(--item-gap, 1ch) * 3));
|
||||
color: var(--item-color, var(--text));
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
padding-left: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
}
|
||||
.list-inline li {
|
||||
padding-left: var(--item-gap, 1ch);
|
||||
}
|
||||
.list-inline li:before {
|
||||
content: var(--item-separator, "•");
|
||||
margin-right: var(--item-gap, 1ch);
|
||||
width: var(--item-gap, 1ch);
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
.list-inline a {
|
||||
color: var(--item-color, var(--text));
|
||||
text-decoration: none;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.list-inline a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Focus */
|
||||
* {
|
||||
outline-offset: 2px;
|
||||
outline-width: 2px;
|
||||
outline-color: #0a76f6;
|
||||
}
|
||||
:focus:focus-visible {
|
||||
outline-style: solid;
|
||||
}
|
||||
|
||||
/* Other */
|
||||
*,
|
||||
:before,
|
||||
|
|
|
|||
92
src/css/utilities.css
Normal file
92
src/css/utilities.css
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
.wrapper,
|
||||
.wrapper-full {
|
||||
grid-template-columns: 1fr min(
|
||||
var(--wrapper-max-length, var(--line-length)),
|
||||
100% - var(--wrapper-gap, var(--gutter)) * 2
|
||||
) 1fr;
|
||||
grid-column-gap: var(--wrapper-gap, var(--gutter));
|
||||
display: grid;
|
||||
}
|
||||
.wrapper > *,
|
||||
.wrapper-full > * {
|
||||
grid-column: 2;
|
||||
}
|
||||
.wrapper-full {
|
||||
grid-template-columns: 1fr min(
|
||||
var(--wrapper-max-length, var(--line-length-large)),
|
||||
100% - var(--wrapper-gap, var(--gutter)) * 2
|
||||
) 1fr;
|
||||
}
|
||||
.full-bleed {
|
||||
inline-size: 100%;
|
||||
padding: var(--padding-block, 1rem) var(--padding-inline, 2rem);
|
||||
background-color: var(--background-color, none);
|
||||
grid-column: 1/-1;
|
||||
}
|
||||
.flex {
|
||||
display: inline-flex;
|
||||
}
|
||||
.flex-col {
|
||||
flex-direction: column;
|
||||
}
|
||||
.justify-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
.justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
.items-center {
|
||||
align-items: center;
|
||||
}
|
||||
.sr-only {
|
||||
clip: rect(0, 0, 0, 0) !important;
|
||||
white-space: nowrap !important;
|
||||
border: 0 !important;
|
||||
block-size: 1px !important;
|
||||
inline-size: 1px !important;
|
||||
margin: -1px !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
.invisible {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
.list-inline {
|
||||
margin-left: calc(var(--item-gap, 1ch) * 3 * -1);
|
||||
clip-path: inset(0 0 0 calc(var(--item-gap, 1ch) * 3));
|
||||
color: var(--item-color, var(--text));
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
padding-left: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
}
|
||||
.list-inline li {
|
||||
padding-left: var(--item-gap, 1ch);
|
||||
}
|
||||
.list-inline li:before {
|
||||
content: var(--item-separator, "•");
|
||||
margin-right: var(--item-gap, 1ch);
|
||||
width: var(--item-gap, 1ch);
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
}
|
||||
.list-inline a {
|
||||
color: var(--item-color, var(--text));
|
||||
text-decoration: none;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.list-inline a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Focus */
|
||||
* {
|
||||
outline-offset: 2px;
|
||||
outline-width: 2px;
|
||||
outline-color: #0a76f6;
|
||||
}
|
||||
:focus:focus-visible {
|
||||
outline-style: solid;
|
||||
}
|
||||
|
|
@ -7,4 +7,6 @@ link: https://www.artionet.ch
|
|||
dates:
|
||||
start: 2021
|
||||
end: 2022
|
||||
---
|
||||
---
|
||||
|
||||
* Stage de 4ème année de CFC, développement web
|
||||
|
|
@ -7,4 +7,6 @@ link: https://www.artionet.ch
|
|||
dates:
|
||||
start: 2022
|
||||
end: Present
|
||||
---
|
||||
---
|
||||
|
||||
* Développeur Front-End et Support Client
|
||||
|
|
@ -6,4 +6,6 @@ location: Porrentruy
|
|||
dates:
|
||||
start: 2018
|
||||
end: 2022
|
||||
---
|
||||
---
|
||||
|
||||
* CFC d'informaticien d'entreprise
|
||||
Loading…
Reference in a new issue