-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
renderTemplate fails with simple example (global versus local install) #2100
Comments
So this is interesting. I have beta8 installed globally. I also have it installed in my test folder. If I run eleventy, I get the error above. If I specifically use the local copy with npx eleventy, it runs fine. Both output the exact same version. |
We do have an automated test suite for these plugins that does run on Windows too https://github.com/11ty/eleventy/actions/runs/1472651558 |
Can you try where Eleventy is not in node_modules but installed globally? |
Had to get my $NODE_PATH going again for global node_modules but I got the same successful result 😭 |
Sorry to do this but can you make a reduced test case repo that shows this locally for you? I don’t think I’m seeing all the |
Not a problem - will do so but may take a day. |
Here there are no errors - instead the template render simply stops. Upon {% extends "base.njk" %}
{% set content %}
<section id="book-title">
{% renderTemplate "md" %}
# Title of Book
by Author
{% endrenderTemplate %}
</section>
{% endset %} results in the following markup <!DOCTYPE html>
<html lang="en">
<body>
<div id="page">
<section id="book-title">
</div>
</body>
</html> i.e the template fails to render past the point of the Platform: $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
$ node -v
v16.13.0
$ npm -v
8.1.0
$ FYI: https://github.com/11ty/eleventy/blob/master/src/TemplateRender.js#L29 console.log('\ninputDir', inputDir);
this.inputDir = inputDir ? inputDir : this.config.dir.input;
console.log('this.inputDir', this.inputDir);
this.includesDir = TemplatePath.join(
this.inputDir,
this.config.dir.includes
);
console.log('includesDir:', this.includesDir); results in $ npm run build
> [email protected] build
> npx @11ty/eleventy
inputDir src
this.inputDir src
includesDir: src/_includes
inputDir src/_includes
this.inputDir src/_includes
includesDir: src/_includes/_includes
[11ty] Writing dist/index.html from ./src/index.njk
[11ty] Wrote 1 file in 0.08 seconds (v1.0.0-beta.8) So that second |
So to be clear, you see an error (template not rendering), but not the same issue in console as me? Also, do you see a difference between global |
Given I can get it to fail locally I never explored a global installation. However I used your error message to zero in on the faulty Too be clear I'm not familiar with the code that creates The difference between "build error" and "no build error" may simply be a manifestation of "liquid" vs "nunjucks" responding to the same root cause. |
Awesome, thank you for a test case—lookin’ |
Couple of things came from this issue. We were absolutely passing in the wrong directory there to Template Render. That fix will go up with Beta.9 The other thing happening here is a Nunjucks specific issue with nested async shortcodes. Work in progress is happening here for that #1749 |
…plateRender. Found via #2100 #2100 (comment)
This still doesn't sound exactly like my issue, but I'm going to wait and test again in 9. :) |
Looks like I'll be using the following for a while {# src/index.njk #}
{% extends "base.njk" %}
{% set content %}
<section id="book-title">
{% renderTemplateMd %}
# Title of Book
by Author
{% endrenderTemplateMd %}
</section>
{% endset %} // .eleventy.js
//
const markdownIt = require('markdown-it');
const md = markdownIt({
html: true,
});
function renderMd(content, inline) {
return inline ? md.renderInline(content) : md.render(content);
}
const dir = {
input: 'src',
includes: '_includes',
output: 'dist',
};
module.exports = function(config) {
config.addPairedShortcode("renderTemplateMd", renderMd);
return {
dir
};
}; resulting in <!DOCTYPE html>
<html lang="en">
<body>
<div id="page">
<section id="book-title">
<h1>Title of Book</h1>
<p>by Author</p>
</section>
</div>
</body>
</html> |
For the record @peerreynders I believe your issue is separate @cfjedimaster’s original issue. I filed yours at #2108. Specifically note this comment: #2108 (comment) |
My suspicion here @cfjedimaster is that this might be mixing and matching a global with a local installation? Like, maybe you’re executing a global Eleventy but it’s requiring from a local Eleventy. And the versions are different? What’s your NODE_PATH? Are there local installations of Eleventy at play? |
Both the local Eleventy and global are the same version version. NODE_PATH is not defined. |
FYI, I stumbled on the same issue as originally reported when using eleventy Github action while my local build works. I use v2.0.1 locally. The Github action is doing a global install of eleventy, but then also runs an |
Describe the bug
I'm trying this simple example of the renderTemplate feature (using beta8):
And when I run eleventy, I get:
To Reproduce
See above. :)
Expected behavior
I'd expect the block to render from Markdown.
Environment:
eleventy --version
ornpx @11ty/eleventy --version
] v1.0.0-beta.8The text was updated successfully, but these errors were encountered: