diff --git a/_includes/page.njk b/_includes/page.njk index 6f4689b..9fca637 100644 --- a/_includes/page.njk +++ b/_includes/page.njk @@ -14,6 +14,7 @@ eleventyComputed: + {% favicons '_site/ESELogoFavicon.svg' %} {% include 'header.njk' %} diff --git a/content/ESELogoFavicon.logo.svg b/content/ESELogoFavicon.logo.svg new file mode 100644 index 0000000..269b841 --- /dev/null +++ b/content/ESELogoFavicon.logo.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + diff --git a/eleventy.config.js b/eleventy.config.js index 76e8f0e..a25d453 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,5 +1,6 @@ const { EleventyHtmlBasePlugin, EleventyI18nPlugin } = require("@11ty/eleventy"); const eleventyNavigationPlugin = require("@11ty/eleventy-navigation"); +const faviconsPlugin = require("eleventy-plugin-gen-favicons"); const bundlerPlugin = require("@11ty/eleventy-plugin-bundle"); const pluginIcons = require('eleventy-plugin-icons'); const Image = require("@11ty/eleventy-img"); @@ -24,6 +25,7 @@ module.exports = function(eleventyConfig) { shortcode: "rawIcon", }, }); + eleventyConfig.addPlugin(faviconsPlugin, {}); // override icon shortcode to make the SVGs accessible eleventyConfig.addAsyncShortcode("icon", async function(input, attrs) { @@ -81,7 +83,13 @@ module.exports = function(eleventyConfig) { }); await session.replaceAll(); - return session.getSvgString(); + let finalSvg = session.getSvgString(); + + // no idea why this gets mangled + finalSvg = finalSvg.replaceAll("svg:svg", "svg"); + finalSvg = '\n' + finalSvg; + + return finalSvg; }; } }); @@ -130,7 +138,7 @@ module.exports = function(eleventyConfig) { async ({ dir, runMode, outputMode }) => { if (outputMode === "fs") { fs.copyFile(`${dir.output}/de/index.html`, `${dir.output}/index.html`, (err) => { - if (err) console.log(err); + if (err && err.code !== 'ENOENT') console.log(err); }); } } diff --git a/package-lock.json b/package-lock.json index a38f4dd..0d96be1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@11ty/eleventy-navigation": "^0.3.5", "@11ty/eleventy-plugin-bundle": "^1.0.5", "@fortawesome/fontawesome-free": "^6.6.0", + "eleventy-plugin-gen-favicons": "^1.1.3", "eleventy-plugin-icons": "^4.5.1", "js-yaml": "^4.1.0", "markdown-it": "^14.1.0", @@ -841,6 +842,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/node": { + "version": "17.0.45", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", + "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", + "dev": true, + "license": "MIT" + }, "node_modules/a-sync-waterfall": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", @@ -1623,6 +1631,18 @@ "node": ">=0.10.0" } }, + "node_modules/eleventy-plugin-gen-favicons": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/eleventy-plugin-gen-favicons/-/eleventy-plugin-gen-favicons-1.1.3.tgz", + "integrity": "sha512-MvE2uDiFNU82b8m8L8hOQRANE2ljjZWglXwqxSG7ECgr5QLUIE8nyGQ2xDLutzXxti2ljVhttwpjU5z4P2SCeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "png-to-ico": "^2.1.8", + "sharp": "^0.33.4" + } + }, "node_modules/eleventy-plugin-icons": { "version": "4.5.1", "resolved": "https://registry.npmjs.org/eleventy-plugin-icons/-/eleventy-plugin-icons-4.5.1.tgz", @@ -3353,6 +3373,34 @@ "semver-compare": "^1.0.0" } }, + "node_modules/png-to-ico": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/png-to-ico/-/png-to-ico-2.1.8.tgz", + "integrity": "sha512-Nf+IIn/cZ/DIZVdGveJp86NG5uNib1ZXMiDd/8x32HCTeKSvgpyg6D/6tUBn1QO/zybzoMK0/mc3QRgAyXdv9w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "^17.0.36", + "minimist": "^1.2.6", + "pngjs": "^6.0.0" + }, + "bin": { + "png-to-ico": "bin/cli.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pngjs": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-6.0.0.tgz", + "integrity": "sha512-TRzzuFRRmEoSW/p1KVAmiOgPco2Irlah+bGFCeNfJXxxYGwSw7YwAOAcd7X28K/m5bjBWKsC29KyoMfHbypayg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.13.0" + } + }, "node_modules/posthtml": { "version": "0.16.6", "resolved": "https://registry.npmjs.org/posthtml/-/posthtml-0.16.6.tgz", diff --git a/package.json b/package.json index 7c92fa5..5a870ce 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "This is the WIP rewrite of the ESE website.", "main": "index.js", "scripts": { + "prebuild": "npx @11ty/eleventy --formats=logo.svg", "build": "npx @11ty/eleventy", + "prestart": "npx @11ty/eleventy --formats=logo.svg", "start": "npx @11ty/eleventy --serve" }, "author": "FSR Informatik TU Dresden", @@ -15,6 +17,7 @@ "@11ty/eleventy-navigation": "^0.3.5", "@11ty/eleventy-plugin-bundle": "^1.0.5", "@fortawesome/fontawesome-free": "^6.6.0", + "eleventy-plugin-gen-favicons": "^1.1.3", "eleventy-plugin-icons": "^4.5.1", "js-yaml": "^4.1.0", "markdown-it": "^14.1.0",