From ab4c01dc98aceb70ab5ccba41620d3ae436e8982 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Tue, 19 Nov 2024 00:55:34 -0500 Subject: [PATCH] feat: rewrite templates using vento (#232) --- eleventy.config.js | 11 ++- package.json | 1 + pnpm-lock.yaml | 69 +++++++++++++++++ src/_includes/postslist.njk | 29 ------- src/_includes/projectslist.njk | 32 -------- src/_layouts/page.njk | 6 -- src/_layouts/post.njk | 56 -------------- 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/{_layouts/base.njk => layouts/base.vto} | 75 +++++++++---------- src/layouts/page.vto | 6 ++ src/layouts/post.vto | 56 ++++++++++++++ src/posts/index.njk | 8 -- src/posts/index.vto | 9 +++ src/posts/posts.json | 2 +- src/privacy.md | 2 +- src/projects.njk | 15 ---- src/projects.vto | 15 ++++ src/tags.njk | 19 ----- src/tags.vto | 20 +++++ src/{uses.njk => uses.vto} | 18 ++--- tailwind.config.js | 2 +- 26 files changed, 309 insertions(+), 230 deletions(-) delete mode 100644 src/_includes/postslist.njk delete mode 100644 src/_includes/projectslist.njk delete mode 100644 src/_layouts/page.njk delete mode 100644 src/_layouts/post.njk 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} (53%) rename src/generated/{robots.txt.njk => robots.txt.vto} (60%) rename src/generated/{site.webmanifest.njk => site.webmanifest.vto} (100%) rename src/{_layouts/base.njk => layouts/base.vto} (70%) create mode 100644 src/layouts/page.vto create mode 100644 src/layouts/post.vto 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 delete mode 100644 src/tags.njk create mode 100644 src/tags.vto rename src/{uses.njk => uses.vto} (61%) diff --git a/eleventy.config.js b/eleventy.config.js index fad6dd13..8ca2bb4c 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 { @@ -78,6 +80,7 @@ export default eleventy(function (eleventyConfig) { }, ], }); + eleventyConfig.addPlugin(VentoPlugin); /* Passthrough Copy */ eleventyConfig.addPassthroughCopy({ 'public/': '.' }); @@ -123,11 +126,11 @@ export default eleventy(function (eleventyConfig) { dir: { input: 'src', output: 'dist', - includes: '_includes', - layouts: '_layouts', + includes: 'components', + 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 66a113b6..ca595234 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.28.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 144fbe58..ea918272 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 @@ -247,6 +250,12 @@ packages: '@catppuccin/palette@1.7.1': resolution: {integrity: sha512-aRc1tbzrevOTV7nFTT9SRdF26w/MIwT4Jwt4fDMc9itRZUDXCuEDBLyz4TQMlqO9ZP8mf5Hu4Jr6D03NLFc6Gw==} + '@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==} @@ -517,6 +526,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==} @@ -910,6 +922,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-xs@1.0.0: resolution: {integrity: sha512-LRlerrMYoIDrT6jgpeZ2YYl/L8EulRTt5hQcYjy5AInh7HWXKimpqx68aknBFpGL2+/IcogTcaydJEgaTmOpDg==} @@ -984,6 +1000,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'} @@ -1225,6 +1244,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'} @@ -1444,6 +1467,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.1: resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==} @@ -2041,6 +2068,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==} @@ -2058,6 +2088,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'} @@ -2289,6 +2324,13 @@ snapshots: '@catppuccin/palette@1.7.1': {} + '@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 @@ -2535,6 +2577,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 @@ -2912,6 +2956,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-xs@1.0.0: {} emoji-regex@8.0.0: {} @@ -2960,6 +3011,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: {} @@ -3226,6 +3281,8 @@ snapshots: isexe@2.0.0: {} + isexe@3.1.1: {} + iso-639-1@3.1.3: {} jackspeak@3.4.3: @@ -3423,6 +3480,8 @@ snapshots: merge2@1.4.1: {} + meriyah@6.0.3: {} + micromark-util-character@2.1.1: dependencies: micromark-util-symbol: 2.0.1 @@ -4056,6 +4115,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 @@ -4077,6 +4142,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 }}
-{{ post.data.description }}
+Uh oh.. Couldn't find that page.
diff --git a/src/generated/feed.xml.njk b/src/generated/feed.xml.vto similarity index 53% rename from src/generated/feed.xml.njk rename to src/generated/feed.xml.vto index 50ee9c89..6636540f 100644 --- a/src/generated/feed.xml.njk +++ b/src/generated/feed.xml.vto @@ -5,20 +5,21 @@ eleventyExcludeFromCollections: false