Skip to content

feat(lessons/{2,3,5,6,7}): eleventy@v3 & ESM#16

Merged
uncenter merged 21 commits intouncenter:devfrom
SteelMaverick:ESMUpdate
Jul 7, 2025
Merged

feat(lessons/{2,3,5,6,7}): eleventy@v3 & ESM#16
uncenter merged 21 commits intouncenter:devfrom
SteelMaverick:ESMUpdate

Conversation

@SteelMaverick
Copy link
Contributor

Lesson 2 got a number of updates:

-Config file name: .eleventy.js -> eleventy.config.js
-Eleventy's behaviour is now configured through Eleventy's configuration API
-package.json updates
-package.json additional configuration added to treat all .js files as ES Modules (saves us needing to format .js files as .mjs.
-More informative info boxes and tips to support changes.

Couple of changes but I'm expecting it to go downhill from here for the rest of the lessons. I also just realised a small typo at line 24.

Lesson1 needed no updates.

… configuration to package.json to treat all .js files as ESM. Added extra information to accompany these changes.
@SteelMaverick
Copy link
Contributor Author

Pushed update for Lesson3 using ESM syntax to configure Eleventy to use Nunjucks. Fixed typo back in Lesson2 (meant line 39, not 24).

@SteelMaverick SteelMaverick changed the title Version 3 and ESM Updates for Lesson 2 Version 3 and ESM Updates Feb 6, 2025
@SteelMaverick
Copy link
Contributor Author

I forgot to bring up for Lesson3, I was taking a look through the docs, I don't see anything recent on this configuration anywhere: dataTemplateEngine. This was the last thing I found documented about it: https://www.11ty.dev/blog/eleventy-one-point-oh/

I'm potentially thinking about omitting this. It hasn't broken the site my end at least removing it.

@uncenter
Copy link
Owner

uncenter commented Feb 7, 2025

I don't even see it in the source code! Good call.

SteelMaverick and others added 12 commits February 6, 2025 16:25
Added start script as suggested by the tip

Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>
Removed properties that aren't needed to function

Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>
Removed more properties not needed for functionality

Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>
Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>
Information not relevant to project

Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>
Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>
…n 2.md

Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>
Information provided not relevant to the project and should stick to the preferred implementation.

Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>
Co-authored-by: uncenter <47499684+uncenter@users.noreply.github.com>
@SteelMaverick
Copy link
Contributor Author

Changes done up to Lesson7, Lesson4 and 6 needed no updates.

@SteelMaverick
Copy link
Contributor Author

Just a question looking at Lesson8 and possibly for future lessons, pretty much they create a collection, then go into refactoring by creating the utility .js file then go back to tidy up the collection that was just created to remove duplication. Think that should be re-ordered to create the utility first then create the collection?

@uncenter
Copy link
Owner

I think we can reorder it so after creating the first collection, and mentioning that we want to create another, we create the utility, update the first collection, and then use the new utility in the second collection from the get-go. We can also avoid using a src/utils folder and probably just define a new local function in the .eleventy.js file, outside of the exported config function.

…s only used there to create collections and it is also a relatively short function. Removed steps to create utils folder as it is no longer needed. Updated collection creation syntax.
@SteelMaverick
Copy link
Contributor Author

Updated Lesson8 with suggested changes.

2.md Outdated
"version": "1.0.0",
"description": "",
"main": ".eleventy.js",
"main": "eleventy.config.js",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually don't think this is necessary for anything since I believe main only applies for published packages? Or how does this affect the project to your knowledge?

config.addPassthroughCopy('./src/images/');
eleventyConfig.addPassthroughCopy('src/images');
```

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add another "Your eleventy.config.js file should now look like this:" line here for clarity. (I'm planning to eventually refactor that kind of thing into "diff" views with https://shiki.style/packages/transformers#transformernotationdiff but for now this is good.)

@uncenter
Copy link
Owner

uncenter commented Jul 5, 2025

Sorry for the length delay and lengthy review. Please let me know if you'd like to continue working on this pull request or not, if not (totally fine, I understand!) I'll merge this into a working branch (https://github.com/uncenter/learn-eleventy/tree/dev) and try to get this ESM refactor done there.

@uncenter uncenter changed the base branch from main to dev July 7, 2025 01:19
@uncenter uncenter changed the title Version 3 and ESM Updates feat(lessons/{2,3,5,6,7}): eleventy@v3 & ESM Jul 7, 2025
@uncenter
Copy link
Owner

uncenter commented Jul 7, 2025

Going to merge this with my fixes into thedev branch. Feel free to open follow up pull requests if I made any mistakes or missed anything or if there is anything else you'd like to change.

@uncenter uncenter merged commit ba656f6 into uncenter:dev Jul 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants