Example repo for 11ty/eleventy#2248.
This gist was created by @pspeter3!
| // Using the command: DEBUG=Eleventy:Image* npx @11ty/eleventy | |
| // will report the concurrency value used. | |
| import eleventyImage, { eleventyImageTransformPlugin } from "@11ty/eleventy-img"; | |
| eleventyImage.concurrency = 1; | |
| export default async function (eleventyConfig) { | |
| eleventyConfig.addPlugin(eleventyImageTransformPlugin, { | |
| // … |
| import { DateTime } from "luxon"; | |
| export default function(eleventyConfig) { | |
| // requires Eleventy v3.0+ | |
| eleventyConfig.addDateParsing(function(dateValue) { | |
| if(typeof dateValue === "string") { // override String dates | |
| return DateTime.fromISO(dateValue, { zone: "America/Chicago" }); | |
| } | |
| }); | |
| }; |
Example repo for 11ty/eleventy#2248.
This gist was created by @pspeter3!
| const { google, outlook, office365, yahoo, ics } = require("calendar-link"); | |
| module.exports = function(eleventyConfig) { | |
| // `event` structure documented on https://www.npmjs.com/package/calendar-link | |
| eleventyConfig.addLiquidFilter("addToCalendar", (event, type) => { | |
| if(type === "google") { | |
| return google(event); | |
| } else if(type === "office365") { | |
| return office365(event); | |
| } else if(type === "outlook") { |
| const { minify } = require('terser'); | |
| const jsMinCache = {}; | |
| module.exports = function (eleventyConfig) { | |
| eleventyConfig.addNunjucksAsyncFilter('jsmin', async function (code, callback) { | |
| try { | |
| if(jsMinCache[code]) { | |
| callback(null, jsMinCache[code]); | |
| } else { | |
| const minified = await minify(code); |
| // via https://www.11ty.dev/docs/languages/handlebars/#optional-set-your-own-library-instance | |
| module.exports = function(eleventyConfig) { | |
| let handlebars = require("handlebars"); | |
| // see https://handlebarsjs.com/guide/partials.html#basic-partials | |
| handlebars.registerPartial("name", "Handlebars syntax"); | |
| eleventyConfig.setLibrary("hbs", handlebars); | |
| }; |
| const assert = require("assert"); | |
| const inspect = require("util").inspect; | |
| module.exports= (eleventyConfig) => { | |
| // ever so slightly modified from @pdehaan’s original: | |
| // https://github.com/11ty/eleventy/issues/278#issuecomment-873367464 | |
| const slugFn = eleventyConfig.getFilter("slug"); | |
| const slugifyFn = eleventyConfig.getFilter("slugify"); | |
| const slugErrors = new Set(); |
| module.exports = function(eleventyConfig) { | |
| eleventyConfig.setBrowserSyncConfig({ | |
| snippetOptions: { | |
| rule: { | |
| fn: function(snippet, match) { | |
| return match; | |
| } | |
| } | |
| } | |
| }); |
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta name="description" content=""> | |
| <title></title> | |
| </head> | |
| <body> | |
| /* | |
| Queue Code | |
| https://queuecode.zachleat.dev/ | |
| Usage: | |
| - Press any key to reveal the next character of source code. Use delete to hide characters. | |
| - Use the `url` query param to point to a different source code file. | |
| e.g. https://queuecode.zachleat.dev/?url=https://gist.githubusercontent.com/zachleat/a7393810acf7890e6bef6a34eaa7b78c/raw/smoothscroll.css |