hippie/.eleventy.js
sthag d64bf61a9c feat: Replace layouts template
- Change nunjucks to liquid for layouts screen
- Add shortcodes for placeholders to eleventy
2026-02-21 12:16:34 +01:00

85 lines
2.3 KiB
JavaScript

const {EleventyHtmlBasePlugin} = require("@11ty/eleventy");
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.setLiquidOptions({
// greedy: false,
// trimOutputLeft: true,
// trimOutputRight: true,
// trimTagLeft: true,
// trimTagRight : true,
});
eleventyConfig.setNunjucksEnvironmentOptions({
// throwOnUndefined: true,
trimBlocks: true
});
eleventyConfig.addGlobalData('permalink', () => {
return (data) => `${data.page.filePathStem}.${data.page.outputFileExtension}`;
});
let demoMode = false;
let pageBase = demoMode ? './demo/' : './';
eleventyConfig.addGlobalData('hippie', {
pageBase: pageBase,
brand: 'hippie',
titlePrefix: '',
titlePostfix: ' - HIPPIE',
placeholders: {
name: 'Vorname Nachname',
address: 'Straße Nr., PLZ Ort',
phone: '+49 (0)101 1337 48',
mail: 'name@domain.tld'
},
debugMode: true,
legacyMode: false
});
eleventyConfig.addShortcode('text', function (text, attrId, attrClass) {
return `<span id="${attrId}" class="${attrClass}">${text}</span>`;
});
eleventyConfig.addShortcode('link', function (target, text, attrId, attrClass) {
if (text === '') {
text = target;
}
if (target.indexOf('@') !== -1) {
target = 'mailto:' + target;
}
return `<a id="${attrId}" class="${attrClass}" href="${target}">${text}</a>`;
});
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'});
eleventyConfig.addPassthroughCopy('vendor');
eleventyConfig.addPassthroughCopy({'node_modules/bootstrap-icons': 'vendor/bootstrap-icons'});
eleventyConfig.addPassthroughCopy({
'node_modules/jquery/dist/jquery.min.js': 'vendor/jquery.min.js',
'node_modules/jquery/dist/jquery.min.map': 'vendor/jquery.min.map'
});
eleventyConfig.addPassthroughCopy({'node_modules/hippie-script/index.js': 'vendor/hippie-script.js'});
eleventyConfig.addWatchTarget('./source/style/');
return {
dir: {
input: 'source/screens',
output: 'build',
includes: '../templates',
data: '../data'
},
templateFormats: ['html', 'liquid', 'njk', 'md']
// pathPrefix: './demo/'
};
};