From 6422ee1980460cc316ca9ee1271f6dd9e799613e Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:37:11 -0500 Subject: [PATCH 1/3] feat: rewrite templates using vento --- eleventy.config.js | 8 +- package.json | 1 + pnpm-lock.yaml | 69 +++++++++++++++++ src/_includes/postslist.njk | 29 ------- src/_includes/projectslist.njk | 32 -------- src/_layouts/{base.njk => base.vto} | 75 +++++++++---------- src/_layouts/page.njk | 6 -- src/_layouts/page.vto | 6 ++ src/_layouts/{post.njk => post.vto} | 58 +++++++------- src/components/postslist.vto | 33 ++++++++ src/components/projectslist.vto | 34 +++++++++ src/generated/{404.njk => 404.vto} | 2 +- src/generated/{feed.xml.njk => feed.xml.vto} | 17 +++-- .../{robots.txt.njk => robots.txt.vto} | 2 +- ...e.webmanifest.njk => site.webmanifest.vto} | 0 src/posts/index.njk | 8 -- src/posts/index.vto | 9 +++ src/posts/posts.json | 2 +- src/projects.njk | 15 ---- src/projects.vto | 15 ++++ src/{tags.njk => tags.vto} | 7 +- src/{uses.njk => uses.vto} | 18 ++--- tailwind.config.js | 2 +- 23 files changed, 264 insertions(+), 184 deletions(-) delete mode 100644 src/_includes/postslist.njk delete mode 100644 src/_includes/projectslist.njk rename src/_layouts/{base.njk => base.vto} (70%) delete mode 100644 src/_layouts/page.njk create mode 100644 src/_layouts/page.vto rename src/_layouts/{post.njk => post.vto} (50%) create mode 100644 src/components/postslist.vto create mode 100644 src/components/projectslist.vto rename src/generated/{404.njk => 404.vto} (90%) rename src/generated/{feed.xml.njk => feed.xml.vto} (54%) rename src/generated/{robots.txt.njk => robots.txt.vto} (60%) rename src/generated/{site.webmanifest.njk => site.webmanifest.vto} (100%) delete mode 100644 src/posts/index.njk create mode 100644 src/posts/index.vto delete mode 100644 src/projects.njk create mode 100644 src/projects.vto rename src/{tags.njk => tags.vto} (57%) rename src/{uses.njk => uses.vto} (61%) diff --git a/eleventy.config.js b/eleventy.config.js index fad6dd13..7c838e04 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -7,6 +7,8 @@ import pluginAutoCacheBuster from 'eleventy-auto-cache-buster'; import pluginIcons from 'eleventy-plugin-icons'; import pluginValidate from 'eleventy-plugin-validate'; +import { VentoPlugin } from 'eleventy-plugin-vento'; + import markdownLibrary from './config/markdown/core.js'; import { @@ -27,6 +29,8 @@ import site from './site.config.js'; import eleventy from '11ty.ts'; export default eleventy(function (eleventyConfig) { + eleventyConfig.addPlugin(VentoPlugin); + eleventyConfig.addGlobalData('site', site); eleventyConfig.addPlugin(shortcodes); eleventyConfig.addPlugin(collections); @@ -127,7 +131,7 @@ export default eleventy(function (eleventyConfig) { layouts: '_layouts', data: '_data', }, - templateFormats: ['md', 'njk', '11ty.js'], - markdownTemplateEngine: 'njk', + templateFormats: ['md', 'vto', '11ty.js'], + markdownTemplateEngine: 'vto', }; }); diff --git a/package.json b/package.json index c2f736be..ac93373e 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "eleventy-auto-cache-buster": "^0.6.1", "eleventy-plugin-icons": "^4.5.1", "eleventy-plugin-validate": "^0.1.3", + "eleventy-plugin-vento": "^4.0.1", "html-minifier": "^4.0.0", "image-size": "^1.1.1", "lightningcss": "^1.27.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2f4c5d04..427eb1b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,6 +53,9 @@ importers: eleventy-plugin-validate: specifier: ^0.1.3 version: 0.1.3 + eleventy-plugin-vento: + specifier: ^4.0.1 + version: 4.0.1 html-minifier: specifier: ^4.0.0 version: 4.0.0 @@ -243,6 +246,12 @@ packages: '@catppuccin/palette@1.4.0': resolution: {integrity: sha512-Npdg/QFeMAEbRVlnJqc1xE3i7NI4liSq4tTTXk4U/L3vPEiqw3bZQJRLYjuP0Vq2AEDNS5H5Li+lk27c38sP4g==} + '@deno/shim-deno-test@0.5.0': + resolution: {integrity: sha512-4nMhecpGlPi0cSzT67L+Tm+GOJqvuk8gqHBziqcUQOarnuIax1z96/gJHCSIz2Z0zhxE6Rzwb3IZXPtFh51j+w==} + + '@deno/shim-deno@0.18.2': + resolution: {integrity: sha512-oQ0CVmOio63wlhwQF75zA4ioolPvOwAoK0yuzcS5bDC1JUvH3y1GS8xPh8EOpcoDQRU4FTG8OQfxhpR+c6DrzA==} + '@emnapi/runtime@1.3.0': resolution: {integrity: sha512-XMBySMuNZs3DM96xcJmLW4EfGnf+uGmFNjzpehMjuX5PLB5j87ar2Zc4e3PVeZ3I5g3tYtAqskB28manlF69Zw==} @@ -500,6 +509,9 @@ packages: resolution: {integrity: sha512-doH1gimEu3A46VX6aVxpHTeHrytJAG6HgdxntYnCFiIFHEM/ZGpG8KiZGBChchjQmG0XFIBL552kBTjVcMZXwQ==} engines: {node: '>=12'} + '@types/estree@1.0.6': + resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/hast@3.0.4': resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==} @@ -884,6 +896,10 @@ packages: eleventy-plugin-validate@0.1.3: resolution: {integrity: sha512-UGzW91YbEeWwGRUy0njDbCTNKuNl8DVmgxGhbyqbDPisSZcqDRtc8Gq5hcURRihvi2t6eD+gZi8G87h4qDSNpg==} + eleventy-plugin-vento@4.0.1: + resolution: {integrity: sha512-gD7Udj/0uE2tiSQUech5mwVTfeD9T2AmVAIuhxtd7hOgN2/MRsptdJHcdanYZLAEd8VmJff3q949sPKPVYZnJQ==} + engines: {node: '>=18'} + emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -955,6 +971,9 @@ packages: estree-is-member-expression@1.0.0: resolution: {integrity: sha512-Ec+X44CapIGExvSZN+pGkmr5p7HwUVQoPQSd458Lqwvaf4/61k/invHSh4BYK8OXnCkfEhWuIoG5hayKLQStIg==} + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + etag@1.8.1: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} @@ -1187,6 +1206,10 @@ packages: isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + isexe@3.1.1: + resolution: {integrity: sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==} + engines: {node: '>=16'} + iso-639-1@3.1.3: resolution: {integrity: sha512-1jz0Wh9hyLMRwqEPchb/KZCiTqfFWtc9R3nm7GHPygBAKS8wdKJ3FH4lvLsri6UtAE5Kz5SnowtXZa//6bqMyw==} engines: {node: '>=6.0'} @@ -1403,6 +1426,10 @@ packages: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} + meriyah@6.0.3: + resolution: {integrity: sha512-NqUbuQIjIH8dxUBPTMHS1kwIHd6n6nF3F7oeLXGWqBkpVP2lZxVHdab5JxbFBisIB4axZ9b/lT4HLJfZxmFK7Q==} + engines: {node: '>=18.0.0'} + micromark-util-character@2.1.0: resolution: {integrity: sha512-KvOVV+X1yLBfs9dCBSopq/+G1PcgT3lAK07mC4BzXi5E7ahzMAF8oIupDDJ6mievI6F+lAATkbQQlQixJfT3aQ==} @@ -1994,6 +2021,9 @@ packages: util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + ventojs@1.12.11: + resolution: {integrity: sha512-76lCfS0/7dFV40fCTz5tTcruCoSCl+preV2upitB2pvh6ntGS5VikCQ4YPgqR+/BfVDxZRF4IQGJ2hmDWF6KhA==} + vfile-message@4.0.2: resolution: {integrity: sha512-jRDZ1IMLttGj41KcZvlrYAaI3CfqpLpfpf+Mfig13viT6NKvRzWZ+lXz0Y5D60w6uJIBAOGq9mSHf0gktF0duw==} @@ -2011,6 +2041,11 @@ packages: engines: {node: '>= 8'} hasBin: true + which@4.0.0: + resolution: {integrity: sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==} + engines: {node: ^16.13.0 || >=18.0.0} + hasBin: true + wrap-ansi@7.0.0: resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} engines: {node: '>=10'} @@ -2232,6 +2267,13 @@ snapshots: '@catppuccin/palette@1.4.0': {} + '@deno/shim-deno-test@0.5.0': {} + + '@deno/shim-deno@0.18.2': + dependencies: + '@deno/shim-deno-test': 0.5.0 + which: 4.0.0 + '@emnapi/runtime@1.3.0': dependencies: tslib: 2.7.0 @@ -2467,6 +2509,8 @@ snapshots: dependencies: escape-string-regexp: 5.0.0 + '@types/estree@1.0.6': {} + '@types/hast@3.0.4': dependencies: '@types/unist': 3.0.3 @@ -2832,6 +2876,13 @@ snapshots: kleur: 4.1.5 zod: 3.23.8 + eleventy-plugin-vento@4.0.1: + dependencies: + debug: 4.3.7 + ventojs: 1.12.11 + transitivePeerDependencies: + - supports-color + emoji-regex@8.0.0: {} emoji-regex@9.2.2: {} @@ -2878,6 +2929,10 @@ snapshots: estree-is-member-expression@1.0.0: {} + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.6 + etag@1.8.1: {} evaluate-value@2.0.0: {} @@ -3134,6 +3189,8 @@ snapshots: isexe@2.0.0: {} + isexe@3.1.1: {} + iso-639-1@3.1.3: {} jackspeak@3.4.3: @@ -3327,6 +3384,8 @@ snapshots: merge2@1.4.1: {} + meriyah@6.0.3: {} + micromark-util-character@2.1.0: dependencies: micromark-util-symbol: 2.0.0 @@ -3950,6 +4009,12 @@ snapshots: util-deprecate@1.0.2: {} + ventojs@1.12.11: + dependencies: + '@deno/shim-deno': 0.18.2 + estree-walker: 3.0.3 + meriyah: 6.0.3 + vfile-message@4.0.2: dependencies: '@types/unist': 3.0.3 @@ -3971,6 +4036,10 @@ snapshots: dependencies: isexe: 2.0.0 + which@4.0.0: + dependencies: + isexe: 3.1.1 + wrap-ansi@7.0.0: dependencies: ansi-styles: 4.3.0 diff --git a/src/_includes/postslist.njk b/src/_includes/postslist.njk deleted file mode 100644 index 3348096b..00000000 --- a/src/_includes/postslist.njk +++ /dev/null @@ -1,29 +0,0 @@ -{%- for post in postslist -%} -
{{ post.data.description }}
-