3 hours ago · Tech · 0 comments

After I began tinkering with DX (developer experience) a few days ago, I knew that was only the beginning. As you can see in my changelog, I add new functionality to my site often. A lot of that functionality lives in the titular .eleventy.js. This script had become more monsterous than bloated, sitting at 866 lines in the single file. Any time I wanted to touch a filter or tweak a collection, I was scrolling through a wall of code to find the right spot. So, I finally did what I should have done months ago: It's refactoring-into-modules time! This post is a walkthrough of how I broke things apart, what bugs I found lurking in the process, and cleanups that were long overdue. The goal was to improve the structure without changing any behaviour or the site for the end-user. The Before State Here's a rough sketch of what .eleventy.js looked like before: // .eleventy.js was 866 lines, with everything in one place const pluginRss = require("@11ty/eleventy-plugin-rss"); // ... 15 more…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.