2026-03-04 19:22:55 +01:00
|
|
|
/* jshint strict: false */
|
2026-02-19 20:43:52 +01:00
|
|
|
|
2026-03-15 08:52:09 +01:00
|
|
|
import fs from 'fs/promises';
|
2026-03-04 19:22:55 +01:00
|
|
|
import {HtmlBasePlugin} from "@11ty/eleventy";
|
2026-03-14 17:00:18 +01:00
|
|
|
import pluginWebc from "@11ty/eleventy-plugin-webc";
|
2026-03-04 19:22:55 +01:00
|
|
|
|
2026-03-15 08:52:09 +01:00
|
|
|
async function hasFiles(dirPath) {
|
|
|
|
|
try {
|
|
|
|
|
const entries = await fs.readdir(dirPath, {withFileTypes: true});
|
|
|
|
|
return entries.some(entry => entry.isFile());
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Error reading directory:', err);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-04 19:22:55 +01:00
|
|
|
// noinspection JSUnusedGlobalSymbols
|
|
|
|
|
export default async function (eleventyConfig) {
|
|
|
|
|
eleventyConfig.addPlugin(HtmlBasePlugin);
|
2026-03-14 17:00:18 +01:00
|
|
|
eleventyConfig.addPlugin(pluginWebc);
|
2024-08-11 12:05:18 +02:00
|
|
|
|
2025-10-26 15:19:14 +01:00
|
|
|
eleventyConfig.setLiquidOptions({
|
|
|
|
|
// greedy: false,
|
|
|
|
|
// trimOutputLeft: true,
|
|
|
|
|
// trimOutputRight: true,
|
|
|
|
|
// trimTagLeft: true,
|
|
|
|
|
// trimTagRight : true,
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-01 12:04:26 +01:00
|
|
|
eleventyConfig.addGlobalData('permalink', () => {
|
2023-10-25 20:25:09 +02:00
|
|
|
return (data) => `${data.page.filePathStem}.${data.page.outputFileExtension}`;
|
|
|
|
|
});
|
2026-03-15 08:52:09 +01:00
|
|
|
|
|
|
|
|
const demoPath = await hasFiles('source/screens') ? '/demo/' : '/';
|
|
|
|
|
|
2025-11-01 12:04:26 +01:00
|
|
|
eleventyConfig.addGlobalData('hippie', {
|
2023-10-25 21:30:02 +02:00
|
|
|
brand: 'hippie',
|
2024-08-08 20:35:08 +02:00
|
|
|
titlePrefix: '',
|
2024-08-10 15:25:41 +02:00
|
|
|
titlePostfix: ' - HIPPIE',
|
2026-02-21 12:16:34 +01:00
|
|
|
placeholders: {
|
|
|
|
|
name: 'Vorname Nachname',
|
|
|
|
|
address: 'Straße Nr., PLZ Ort',
|
|
|
|
|
phone: '+49 (0)101 1337 48',
|
2026-03-10 19:40:03 +01:00
|
|
|
mail: 'name@domain.tld',
|
|
|
|
|
domain: 'https://domain.tld'
|
2026-02-21 12:16:34 +01:00
|
|
|
},
|
2026-03-15 08:52:09 +01:00
|
|
|
demoPath: demoPath,
|
2024-08-11 17:23:31 +02:00
|
|
|
debugMode: true,
|
|
|
|
|
legacyMode: false
|
2023-10-25 21:30:02 +02:00
|
|
|
});
|
|
|
|
|
|
2026-02-21 12:16:34 +01:00
|
|
|
eleventyConfig.addShortcode('text', function (text, attrId, attrClass) {
|
|
|
|
|
return `<span id="${attrId}" class="${attrClass}">${text}</span>`;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
eleventyConfig.addShortcode('link', function (target, text, attrId, attrClass) {
|
2026-03-10 22:13:28 +01:00
|
|
|
if (!text || text === '') {
|
2026-02-21 12:16:34 +01:00
|
|
|
text = target;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (target.indexOf('@') !== -1) {
|
|
|
|
|
target = 'mailto:' + target;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return `<a id="${attrId}" class="${attrClass}" href="${target}">${text}</a>`;
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-12 20:23:17 +01:00
|
|
|
eleventyConfig.addPairedShortcode('brand', function (content, attrClass = 'brand', direction = 'first') {
|
2026-03-08 17:00:04 +01:00
|
|
|
const logo = `
|
|
|
|
|
<svg
|
2026-03-08 18:18:54 +01:00
|
|
|
width="100%"
|
|
|
|
|
height="100%"
|
|
|
|
|
viewBox="0 0 512 512"
|
|
|
|
|
preserveAspectRatio="xMidYMid meet">
|
|
|
|
|
<defs
|
|
|
|
|
id="defs1" />
|
|
|
|
|
<g
|
|
|
|
|
id="layer1">
|
|
|
|
|
<g
|
|
|
|
|
id="g2"
|
|
|
|
|
transform="matrix(0.984375,0,0,0.984375,4,4)"
|
|
|
|
|
style="stroke-width:1.01587">
|
|
|
|
|
<rect
|
|
|
|
|
style="fill:none;stroke:#000000;stroke-width:8.12698;stroke-linecap:square;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
|
|
|
|
id="rect1"
|
|
|
|
|
width="512"
|
|
|
|
|
height="512"
|
|
|
|
|
x="0"
|
|
|
|
|
y="0" />
|
|
|
|
|
<circle
|
|
|
|
|
style="fill:none;stroke:#000000;stroke-width:8.12698;stroke-linecap:square;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
|
|
|
|
id="path1"
|
|
|
|
|
cx="256"
|
|
|
|
|
cy="256"
|
|
|
|
|
r="256" />
|
|
|
|
|
<path
|
|
|
|
|
style="fill:none;stroke:#000000;stroke-width:8.12698;stroke-linecap:butt;stroke-linejoin:bevel;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
|
|
|
|
id="path2"
|
|
|
|
|
d="M 477.7025,128 256,512 34.297496,128 Z"
|
|
|
|
|
</g>
|
|
|
|
|
</g>
|
2026-03-08 17:00:04 +01:00
|
|
|
</svg>
|
|
|
|
|
`;
|
|
|
|
|
let output = '';
|
2026-03-12 20:23:17 +01:00
|
|
|
|
2026-03-08 17:00:04 +01:00
|
|
|
switch (direction) {
|
|
|
|
|
case 'first':
|
|
|
|
|
output = logo + `${content}`;
|
|
|
|
|
break;
|
|
|
|
|
case 'last':
|
|
|
|
|
output = `${content}` + logo;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return `<div class="${attrClass}">` + output + `</div>`;
|
|
|
|
|
});
|
|
|
|
|
|
2025-11-01 12:04:26 +01:00
|
|
|
eleventyConfig.addPassthroughCopy({'source/art/images': 'art'});
|
|
|
|
|
eleventyConfig.addPassthroughCopy({'source/art/favicons/**/*.+(ico|png|svg)': '.'});
|
|
|
|
|
eleventyConfig.addPassthroughCopy({'source/code/**/*.js': 'js'});
|
|
|
|
|
eleventyConfig.addPassthroughCopy({'source/data/**/*.json': 'json'});
|
2023-10-25 20:25:09 +02:00
|
|
|
|
2025-11-01 12:04:26 +01:00
|
|
|
eleventyConfig.addPassthroughCopy('vendor');
|
|
|
|
|
eleventyConfig.addPassthroughCopy({'node_modules/bootstrap-icons': 'vendor/bootstrap-icons'});
|
2025-10-27 21:15:32 +01:00
|
|
|
eleventyConfig.addPassthroughCopy({
|
2025-11-01 12:04:26 +01:00
|
|
|
'node_modules/jquery/dist/jquery.min.js': 'vendor/jquery.min.js',
|
|
|
|
|
'node_modules/jquery/dist/jquery.min.map': 'vendor/jquery.min.map'
|
2025-10-27 21:15:32 +01:00
|
|
|
});
|
2025-11-02 17:18:12 +01:00
|
|
|
eleventyConfig.addPassthroughCopy({'node_modules/hippie-script/index.js': 'vendor/hippie-script.js'});
|
2023-10-25 20:25:09 +02:00
|
|
|
|
2025-11-01 12:04:26 +01:00
|
|
|
eleventyConfig.addWatchTarget('./source/style/');
|
2023-10-25 22:22:19 +02:00
|
|
|
|
2023-10-25 20:25:09 +02:00
|
|
|
return {
|
|
|
|
|
dir: {
|
2025-11-01 12:04:26 +01:00
|
|
|
input: 'source/screens',
|
|
|
|
|
output: 'build',
|
|
|
|
|
includes: '../templates',
|
|
|
|
|
data: '../data'
|
2023-10-25 20:25:09 +02:00
|
|
|
},
|
2026-03-15 09:27:33 +01:00
|
|
|
templateFormats: ['html', 'liquid', 'md', 'njk']
|
2025-10-26 15:19:14 +01:00
|
|
|
};
|
2026-03-04 19:22:55 +01:00
|
|
|
}
|