Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using input: "." with programmatic API when eleventy setup is in another folder does not work #3281

Open
MangelMaxime opened this issue May 10, 2024 · 0 comments

Comments

@MangelMaxime
Copy link

Operating system

macOS Sonoma 14.4

Eleventy

3.0.0-alpha.10

Describe the bug

When using the programmatic API, it seems like using input: "." does not work anymore relatively to the input directory.

I need to use to provide the absolute path instead.

import { dirname, filename } from 'dirname-filename-esm';

const __dirname = dirname(import.meta);

/** @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig */
export default function (eleventyConfig) {
    console.log("Custom Eleventy config file");

    // Configure Eleventy options to your liking
    return {
        dir: {
            // input: ".", // Does not work with programmatic usage
            input: __dirname,
            output: "_site",
        },
        dataTemplateEngine: "njk",
        htmlTemplateEngine: "njk",
        markdownTemplateEngine: "njk",
    };
};

Reproduction steps

  1. Clone https://github.com/MangelMaxime/eleventy-reproduction-programmatic-api-bug-1
  2. npm install
  3. npx vitest and see that the test fails
  4. Go to tests/fixtures/minimal/.eleventy.js and toggle the input configuration line
  5. Run npx vitest again and see that the test passes

Expected behavior

Using input: "." as shown below should work:

/** @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig */
export default function (eleventyConfig) {
    console.log("Custom Eleventy config file");

    // Configure Eleventy options to your liking
    return {
        dir: {
            input: ".",
            output: "_site",
        },
        dataTemplateEngine: "njk",
        htmlTemplateEngine: "njk",
        markdownTemplateEngine: "njk",
    };
};

Reproduction URL

No response

Screenshots

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant