2022-10-20 14:14:05 +00:00
|
|
|
import lume from "lume/mod.ts";
|
|
|
|
import sass from "lume/plugins/sass.ts";
|
|
|
|
import date from "lume/plugins/date.ts";
|
|
|
|
import jsx from "lume/plugins/jsx.ts";
|
|
|
|
import terser from "lume/plugins/terser.ts";
|
|
|
|
import postcss from "lume/plugins/postcss.ts";
|
2022-10-02 18:46:42 +00:00
|
|
|
|
|
|
|
const site = lume();
|
|
|
|
|
2024-03-06 15:34:00 +00:00
|
|
|
const languages = [
|
|
|
|
{
|
|
|
|
name: 'deutsch',
|
|
|
|
slug: 'de',
|
|
|
|
urlPrefix: 'de',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'english',
|
|
|
|
slug: 'en',
|
|
|
|
urlPrefix: '',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
site.data('languages', languages);
|
|
|
|
|
|
|
|
site.preprocess([ '.yml' ], (pages) => {
|
|
|
|
for (const page of pages) {
|
|
|
|
const urlParts = (page.data.url || '').replace(/^\/|\/$/g, '').split('/');
|
|
|
|
const langPrefix = urlParts[0];
|
|
|
|
const currentLang = (() => {
|
|
|
|
if (langPrefix.length === 2) {
|
|
|
|
return languages.find(lang => lang.urlPrefix === langPrefix);
|
|
|
|
}
|
|
|
|
|
|
|
|
return languages.find(lang => lang.urlPrefix.length === 0);
|
|
|
|
})() || languages[0];
|
|
|
|
|
|
|
|
page.data.language = currentLang;
|
|
|
|
page.data.otherLang = languages.find(l => l.slug !== currentLang.slug);
|
|
|
|
page.data.baseURL = page.data.url.replace(new RegExp(`^\\/${currentLang.slug}`), '');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-05-19 13:49:36 +00:00
|
|
|
site.use(sass());
|
2022-10-02 18:46:42 +00:00
|
|
|
site.use(date());
|
|
|
|
site.use(jsx());
|
|
|
|
site.use(terser());
|
|
|
|
site.use(postcss());
|
|
|
|
|
2024-04-12 19:10:18 +00:00
|
|
|
site.loadAssets([ ".js" ]);
|
|
|
|
|
|
|
|
site.copy("assets");
|
|
|
|
site.copy("fonts");
|
2022-10-02 18:46:42 +00:00
|
|
|
|
2024-03-06 15:34:00 +00:00
|
|
|
site.ignore(
|
|
|
|
".direnv",
|
|
|
|
"README.md",
|
|
|
|
"CHANGELOG.md",
|
|
|
|
"LICENSE.md",
|
|
|
|
"docker-compose.yml",
|
|
|
|
);
|
2022-10-03 16:56:34 +00:00
|
|
|
|
2022-10-02 18:46:42 +00:00
|
|
|
export default site;
|
2024-03-06 15:34:00 +00:00
|
|
|
|