This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import env from '../_data/env.js'; | |
| import { clearCssBuildCache } from '../_helpers/css-manipulation.js'; | |
| import { generatePreloadHeaders } from '../_helpers/header-generator.js'; | |
| import { compressHtmlFiles } from '../_helpers/html-compression.js'; | |
| import { compressJavaScriptFiles } from '../_helpers/js-compression.js'; | |
| import { minifyJavaScriptFiles } from '../_helpers/js-minify.js'; | |
| /** | |
| * Register eleventy.before and eleventy.after handlers. | |
| * Only registered when !env.isLocal (production/preview) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Catch-all Pages Function for HTML document content negotiation. | |
| * Serves pre-compressed Brotli 11 .br files when client sends Accept-Encoding: br, | |
| * otherwise passes through to static assets (uncompressed HTML). | |
| * Only runs for GET and HEAD; POST /api/contact is handled by functions/api/contact.js. | |
| */ | |
| async function handleHtmlWithBrotli(request, env) { | |
| const url = new URL(request.url); | |
| const pathname = url.pathname; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fs from 'fs'; | |
| import path from 'path'; | |
| import { brotliCompress, BROTLI_LEVEL } from './compression.js'; | |
| /** | |
| * Recursively find all .html files in a directory. | |
| * @param {string} dir - Directory to search | |
| * @param {string[]} [acc=[]] - Accumulator for results | |
| * @returns {string[]} Relative paths to .html files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { brotliCompressSync } from 'zlib'; | |
| /** Default Brotli compression level (0–11). Level 11 gives best ratio, slowest. */ | |
| export const BROTLI_LEVEL = 11; | |
| /** | |
| * Compress a buffer with Brotli. | |
| * @param {Buffer | Uint8Array | string} input - Input buffer, TypedArray, or string (UTF-8) | |
| * @param {number} [level=BROTLI_LEVEL] - Brotli level 0–11 | |
| * @returns {Buffer} Compressed buffer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import fs from 'fs'; | |
| import path from 'path'; | |
| export function generatePreloadHeaders() { | |
| console.log('🔗 Generating preload headers for CSS files...'); | |
| const cssDir = path.join('./_site', 'css'); | |
| if (!fs.existsSync(cssDir)) { | |
| console.log('CSS directory not found, skipping header generation'); | |
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is my site's Content Security Policy. | |
| // Modify this CSP, don't just copy / paste it! It will break your site! | |
| // You can also use `var` and `let` depending on your coding syntax, they all work | |
| const CSP = ` | |
| base-uri 'self'; | |
| child-src 'self'; | |
| connect-src 'none'; | |
| default-src 'none'; | |
| img-src 'self' https://v1.indieweb-avatar.11ty.dev/; | |
| font-src 'self'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| permalink: feed/feed.txt | |
| eleventyComputed: | |
| layout: null | |
| --- | |
| # {{ metadata.title }} - {{ metadata.author.name }} - {{ metadata.description }} | |
| ## {{ metadata.fulldescription }} | |
| URL: {{ metadata.url }} | |
| {% for post in collections.posts | reverse -%} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import zlib from 'zlib'; | |
| import dotenv from "dotenv"; | |
| import CleanCSS from 'clean-css'; | |
| import fs from 'fs'; | |
| import crypto from 'crypto'; | |
| import path from 'path'; | |
| dotenv.config(); | |
| // An example of how you could add additional CleanCSS settings if required | |
| const cleanCSS = new CleanCSS({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import zlib from 'zlib'; | |
| import dotenv from "dotenv"; | |
| import CleanCSS from 'clean-css'; | |
| import fs from 'fs'; | |
| import crypto from 'crypto'; | |
| import path from 'path'; | |
| dotenv.config(); | |
| // An example of how you could add additional CleanCSS settings if required | |
| const cleanCSS = new CleanCSS({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // CSS Manipulation Module for Eleventy | |
| // Processes, minifies, and compresses CSS with cache busting and Brotli compression | |
| import crypto from "crypto"; | |
| import fs from "fs"; | |
| import path from "path"; | |
| import { brotliCompressSync } from "zlib"; | |
| import CleanCSS from "clean-css"; |
NewerOlder