Skip to content

Commit

Permalink
Getting ready for ESM Eleventy.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Dec 13, 2023
1 parent 47bfcd1 commit 3b047fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/eleventyWebcTemplate.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
const path = require("path");
const debug = require("debug")("Eleventy:WebC");

const { EleventyRenderPlugin } = require("@11ty/eleventy");
const CompileString = EleventyRenderPlugin.String;

function relativePath(inputPath, newGlob) {
// project root
if(newGlob.startsWith("~/")) {
Expand Down Expand Up @@ -117,6 +114,9 @@ module.exports = function(eleventyConfig, options = {}) {
page.setTransform("11ty", async function(content) {
let syntax = this["11ty:type"];
if(syntax) {
const { EleventyRenderPlugin } = await import("@11ty/eleventy");
const CompileString = EleventyRenderPlugin.String;

let fn = await CompileString(content, syntax, {
templateConfig
});
Expand Down
1 change: 1 addition & 0 deletions test/test-chdir.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function normalize(str) {
}

// This needs a CHDIR because the default `components` glob is relative to the root directory (not the input directory)
console.log("Make sure you are running `npm run test` and not `npx ava`");
process.chdir("./test/default-components/");

test("New default components directory, issue #14", async t => {
Expand Down

0 comments on commit 3b047fb

Please sign in to comment.