Skip to content

Commit d37275c

Browse files
Merge pull request #198 from himynameisjonas/npm-and-eleventy-img
11ty-image and npm
2 parents c4db904 + e37bc21 commit d37275c

File tree

13 files changed

+18503
-10942
lines changed

13 files changed

+18503
-10942
lines changed

.eleventy.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,33 @@
11
const extractExcerpt = require("./src/11ty/extract_excerpt");
22
const imageUrl = require("./src/11ty/image_url");
33
const minifyHtml = require("./src/11ty/minify_html");
4-
const pictureElement = require("./src/11ty/picture_element");
54
const pluginRss = require("@11ty/eleventy-plugin-rss");
65
const similarPosts = require("./src/11ty/similar_posts");
76
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
87
const trackingScript = require("./src/11ty/tracking_script");
98
const typeCollection = require("./src/11ty/type_collection");
9+
const { eleventyImageTransformPlugin } = require("@11ty/eleventy-img");
1010

1111
module.exports = function (eleventyConfig) {
1212
eleventyConfig.addPlugin(pluginRss);
1313
eleventyConfig.addPlugin(syntaxHighlight);
14+
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
15+
extensions: "html",
16+
17+
cacheOptions: {
18+
duration: "10y",
19+
},
20+
formats: ["webp", "jpeg"],
21+
22+
widths: ["auto"],
23+
24+
urlPath: "/img/",
25+
defaultAttributes: {
26+
loading: "lazy",
27+
decoding: "async"
28+
}
29+
});
30+
1431

1532
eleventyConfig.setDataDeepMerge(true);
1633
eleventyConfig.setUseGitIgnore(false);
@@ -30,7 +47,6 @@ module.exports = function (eleventyConfig) {
3047

3148
eleventyConfig.addShortcode("excerpt", extractExcerpt);
3249
eleventyConfig.addShortcode("image_url", imageUrl.shortcode);
33-
eleventyConfig.addShortcode("picture_element", pictureElement);
3450
eleventyConfig.addShortcode("tracking_script", trackingScript);
3551

3652
return {

.github/workflows/bookmarks.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ jobs:
1515
- uses: actions/setup-node@v4
1616
with:
1717
node-version: 20.10.0
18-
cache: "yarn"
19-
- run: yarn install --frozen-lockfile
18+
cache: "npm"
19+
- run: npm ci
2020
- name: Fetch bookmarks
21-
run: yarn fetch_bookmarks
21+
run: npm run fetch_bookmarks
2222
env:
2323
RAINDROP_COLLECTION_ID: ${{ secrets.RAINDROP_COLLECTION_ID }}
2424
RAINDROP_TOKEN: ${{ secrets.RAINDROP_TOKEN }}

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
- uses: actions/setup-node@v4
3737
with:
3838
node-version: 20.10.0
39-
cache: "yarn"
40-
- run: yarn install --frozen-lockfile
39+
cache: "npm"
40+
- run: npm ci
4141
- uses: actions/cache/restore@v4
4242
id: cache
4343
with:
@@ -49,7 +49,7 @@ jobs:
4949
11ty-${{ runner.os }}
5050
${{ runner.os }}-11ty
5151
- name: Build 11ty site
52-
run: yarn build
52+
run: npm run build
5353
env:
5454
TINA_CLIENT_ID: ${{ secrets.TINA_CLIENT_ID }}
5555
TINA_SEARCH_TOKEN: ${{ secrets.TINA_SEARCH_TOKEN }}

0 commit comments

Comments
 (0)