Skip to content

Commit

Permalink
Set up Eleventy image plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
kleinfreund committed Nov 17, 2024
1 parent a0044fd commit 334e6df
Show file tree
Hide file tree
Showing 8 changed files with 831 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
_site
.cache
9 changes: 9 additions & 0 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { join } from 'node:path'
import { inspect } from 'node:util'

import { IdAttributePlugin } from '@11ty/eleventy'
import { eleventyImageTransformPlugin } from '@11ty/eleventy-img'
import pluginRss from '@11ty/eleventy-plugin-rss'
import * as cheerio from 'cheerio'
import CleanCSS from 'clean-css'
Expand Down Expand Up @@ -77,6 +78,14 @@ export default function (eleventyConfig) {
eleventyConfig.addFilter('dateToRfc3339', pluginRss.dateToRfc3339)
eleventyConfig.addFilter('getNewestCollectionItemDate', pluginRss.getNewestCollectionItemDate)

// Image plugin
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
defaultAttributes: {
loading: 'lazy',
decoding: 'async',
},
})

return {
dir: {
input: ELEVENTY_INPUT_DIR,
Expand Down
Loading

0 comments on commit 334e6df

Please sign in to comment.