Skip to content

Allow CLI --output=output.html to override permalink of --input=input.html #2184

@thecristen

Description

@thecristen

Describe the bug
I'm using Eleventy on the command line to compile a Nunjucks file into an HTML file. It works great but I'm having trouble getting the output to go where I want to. I want to compile the test.njk file I have in the root directory to test.html in the same directory. I've read the using the same input and output directory pitfall page, but I don't think it applies here.

To Reproduce
Contents of test.njk below, all of the included files are simple HTML files:

<!-- 
  I've got some redacted comments here
 -->
<html lang="en">
  <head>
  {% include "head.html" %}
  <body>
    <div class="body-wrapper" id="body-wrapper">
      {% include "header.html" %}
      <hr>
      {% include "footer.html" %}
    </div>
  {% include "scripts.html" %}
  </body>
</html>

Trying to compile:

eleventy --dryrun --input=test.njk --output=. 
[11ty] Skipping ./test/index.html from ./test.njk

eleventy --dryrun --input=test.njk --output=test.html
[11ty] Skipping test.html/test/index.html from ./test.njk

eleventy --dryrun --input=test.njk --output=./test.html
[11ty] Skipping ./test.html/test/index.html from ./test.njk

Expected behavior

I want test.html output to the root directory, not under a test or test.html folder.
Interestingly, it worked back when I had the file named index.html.

eleventy --input=index.njk --output=.          
[11ty] Writing ./index.html from ./index.njk
[11ty] Wrote 1 file in 0.10 seconds (v1.0.0)

Environment:

  • OS and Version: macOS Monterey 12.1
  • Eleventy Version 1.0.0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions