From a190ecdc3f0e06c35b0bfb3ba825a1b29b162f37 Mon Sep 17 00:00:00 2001 From: Marc Pervaz Boocha Date: Fri, 21 Jun 2024 21:59:53 +0530 Subject: Update deps and updated the about page. On branch main Your branch is up to date with 'origin/main'. Changes to be committed: modified: 404.html modified: _includes/base.html new file: _includes/main.css modified: _includes/page.html modified: _includes/post.html modified: about.html deleted: assets/main.css deleted: atom.xml.njk modified: eleventy.config.js modified: index.html modified: package-lock.json modified: package.json modified: posts.html modified: posts/posts.11tydata.js --- eleventy.config.js | 70 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 7 deletions(-) (limited to 'eleventy.config.js') diff --git a/eleventy.config.js b/eleventy.config.js index edfa2f2..9f83803 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,6 +1,6 @@ import { EleventyHtmlBasePlugin, RenderPlugin, InputPathToUrlTransformPlugin } from '@11ty/eleventy'; import syntaxHighlightPlugin from "@11ty/eleventy-plugin-syntaxhighlight"; -import rssPlugin from "@11ty/eleventy-plugin-rss"; +import { feedPlugin } from "@11ty/eleventy-plugin-rss"; import eleventyNavigationPlugin from "@11ty/eleventy-navigation"; import directoryOutputPlugin from "@11ty/eleventy-plugin-directory-output"; import { eleventyImageTransformPlugin } from "@11ty/eleventy-img"; @@ -8,17 +8,75 @@ import pluginWebc from "@11ty/eleventy-plugin-webc"; import { DateTime } from "luxon"; +import postcss from "postcss"; +import cssnano from 'cssnano'; + +import htmlmin from "html-minifier"; + export default async function(eleventyConfig) { eleventyConfig.addPlugin(EleventyHtmlBasePlugin); eleventyConfig.addPlugin(RenderPlugin); eleventyConfig.addPlugin(InputPathToUrlTransformPlugin); eleventyConfig.addPlugin(syntaxHighlightPlugin); - eleventyConfig.addPlugin(rssPlugin); + eleventyConfig.addPlugin(feedPlugin, { + type: "atom", + outputPath: "/atom.xml", + collection: { + name: "post" + }, + metadata: { + language: "en", + title: "Sudomsg", + subtitle: "Messages from Root", + base: "https://sudomsg.com/", + author: { + name: "Marc Pervaz Boocha", + email: "mboocha@sudomsg.com", + } + } + }); eleventyConfig.addPlugin(eleventyNavigationPlugin); eleventyConfig.addPlugin(directoryOutputPlugin); - eleventyConfig.addPlugin(pluginWebc); + eleventyConfig.addPlugin(pluginWebc, { + bundlePluginOptions: { + transforms: [ + async function(content) { + if (this.type === 'css') { + let result = await postcss([ + cssnano({ + preset: "default", + }) + ]).process(content, { + from: this.page.inputPath, + to: null + }); + return result.css; + } + + return content; + } + ] + }, + }); + + eleventyConfig.addTransform("htmlmin", function(content) { + if (this.page.outputPath && this.page.outputPath.endsWith(".html")) { + let minified = htmlmin.minify(content, { + useShortDoctype: true, + removeComments: true, + collapseWhitespace: true, + }); + return minified; + } + + return content; + }); + + eleventyConfig.addPassthroughCopy({ + "./public/": "/", + }); eleventyConfig.addPlugin(eleventyImageTransformPlugin, { extensions: "html", @@ -31,9 +89,6 @@ export default async function(eleventyConfig) { eleventyConfig.setServerPassthroughCopyBehavior("passthrough"); - eleventyConfig.addPassthroughCopy({ - "./public/": "/", - }); eleventyConfig.addFilter("readableDate", (dateObj, format, zone) => { return DateTime.fromJSDate(dateObj, { zone: zone || "utc" }).toFormat(format || "dd LLLL yyyy"); @@ -48,9 +103,10 @@ export default async function(eleventyConfig) { }); eleventyConfig.setQuietMode(true); + eleventyConfig.setDynamicPermalinks(false); return { markdownTemplateEngine: "njk", - htmlTemplateEngine: "njk", + htmlTemplateEngine: "webc", } } -- cgit v1.2.3-70-g09d2