46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
const cdn = require("./src/_data/cdn.json");
|
|
|
|
module.exports = function(eleventyConfig) {
|
|
// Locale-aware content: `t` resolves to the content bundle for the page's locale (fr by default)
|
|
eleventyConfig.addGlobalData("eleventyComputed", {
|
|
locale: (data) => data.locale || "fr",
|
|
t: (data) => data.i18n[data.locale || "fr"]
|
|
});
|
|
|
|
// Serve local images through the BunnyCDN pull zone; leaves external URLs untouched
|
|
eleventyConfig.addFilter("cdn", (path) => {
|
|
if (typeof path !== "string" || !path.startsWith("/")) return path;
|
|
return cdn.url + path;
|
|
});
|
|
|
|
// Copy assets folders to output
|
|
eleventyConfig.addPassthroughCopy("src/assets");
|
|
|
|
// Copy SEO files
|
|
eleventyConfig.addPassthroughCopy("src/robots.txt");
|
|
eleventyConfig.addPassthroughCopy("src/sitemap.xml");
|
|
|
|
// Watch CSS files for changes
|
|
eleventyConfig.addWatchTarget("src/assets/css/");
|
|
|
|
// Watch JS files for changes
|
|
eleventyConfig.addWatchTarget("src/assets/js/");
|
|
|
|
// Configure browser sync to reload on CSS changes
|
|
eleventyConfig.setBrowserSyncConfig({
|
|
files: ['_site/assets/css/**/*.css', '_site/assets/js/**/*.js']
|
|
});
|
|
|
|
return {
|
|
dir: {
|
|
input: "src",
|
|
output: "_site",
|
|
includes: "_includes",
|
|
data: "_data"
|
|
},
|
|
templateFormats: ["html", "md", "njk", "liquid"],
|
|
htmlTemplateEngine: "njk",
|
|
markdownTemplateEngine: "njk"
|
|
};
|
|
};
|