v9 switches to ESM

This commit is contained in:
Zach Leatherman 2023-11-10 16:41:13 -06:00
parent d78b03ae1d
commit 6d64bd2813
7 changed files with 22 additions and 20 deletions

View File

@ -1,4 +1,4 @@
module.exports = { export default {
title: "Eleventy Base Blog v8", title: "Eleventy Base Blog v8",
url: "https://example.com/", url: "https://example.com/",
language: "en", language: "en",

View File

@ -1,4 +1,4 @@
module.exports = { export default {
tags: [ tags: [
"posts" "posts"
], ],

View File

@ -1,3 +1,3 @@
module.exports = { export default {
eleventyExcludeFromCollections: true eleventyExcludeFromCollections: true
} }

View File

@ -24,10 +24,9 @@ function eleventyComputedExcludeFromCollections() {
} }
}; };
module.exports.eleventyComputedPermalink = eleventyComputedPermalink; export { eleventyComputedPermalink, eleventyComputedExcludeFromCollections };
module.exports.eleventyComputedExcludeFromCollections = eleventyComputedExcludeFromCollections;
module.exports = eleventyConfig => { export default function(eleventyConfig) {
eleventyConfig.addGlobalData("eleventyComputed.permalink", eleventyComputedPermalink); eleventyConfig.addGlobalData("eleventyComputed.permalink", eleventyComputedPermalink);
eleventyConfig.addGlobalData("eleventyComputed.eleventyExcludeFromCollections", eleventyComputedExcludeFromCollections); eleventyConfig.addGlobalData("eleventyComputed.eleventyExcludeFromCollections", eleventyComputedExcludeFromCollections);

View File

@ -1,7 +1,7 @@
const path = require("path"); import path from "path";
const eleventyImage = require("@11ty/eleventy-img"); import eleventyImage from "@11ty/eleventy-img";
module.exports = eleventyConfig => { export default function(eleventyConfig) {
function relativeToInputPath(inputPath, relativeFilePath) { function relativeToInputPath(inputPath, relativeFilePath) {
let split = inputPath.split("/"); let split = inputPath.split("/");
split.pop(); split.pop();

View File

@ -1,16 +1,18 @@
const { DateTime } = require("luxon"); import { DateTime } from "luxon";
const markdownItAnchor = require("markdown-it-anchor"); import markdownItAnchor from "markdown-it-anchor";
const pluginRss = require("@11ty/eleventy-plugin-rss"); import pluginRss from "@11ty/eleventy-plugin-rss";
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
const pluginBundle = require("@11ty/eleventy-plugin-bundle"); import pluginBundle from "@11ty/eleventy-plugin-bundle";
const pluginNavigation = require("@11ty/eleventy-navigation"); import pluginNavigation from "@11ty/eleventy-navigation";
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
const pluginDrafts = require("./eleventy.config.drafts.js"); import pluginDrafts from "./eleventy.config.drafts.js";
const pluginImages = require("./eleventy.config.images.js"); import pluginImages from "./eleventy.config.images.js";
/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
export default async function(eleventyConfig) {
const { EleventyHtmlBasePlugin } = await import("@11ty/eleventy");
module.exports = function(eleventyConfig) {
// Copy the contents of the `public` folder to the output folder // Copy the contents of the `public` folder to the output folder
// For example, `./public/css/` ends up in `_site/css/` // For example, `./public/css/` ends up in `_site/css/`
eleventyConfig.addPassthroughCopy({ eleventyConfig.addPassthroughCopy({

View File

@ -1,7 +1,8 @@
{ {
"name": "eleventy-base-blog", "name": "eleventy-base-blog",
"version": "8.0.0", "version": "9.0.0",
"description": "A starter repository for a blog web site using the Eleventy site generator.", "description": "A starter repository for a blog web site using the Eleventy site generator.",
"type": "module",
"scripts": { "scripts": {
"build": "npx @11ty/eleventy", "build": "npx @11ty/eleventy",
"build-ghpages": "npx @11ty/eleventy --pathprefix=/eleventy-base-blog/", "build-ghpages": "npx @11ty/eleventy --pathprefix=/eleventy-base-blog/",