-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
Can’t find layout template in v9.26.0 (using Eleventy v1.0.0-canary.44) #395
Comments
Seems 11ty is relying on |
Supporting customize LiquidOptions on
I think we can do this differently to allow @paulrobertlloyd 's scenario and achieve good perf at the same time. Maybe:
The second approach maybe better, but still need LiquidJS make changes and 11ty then make corresponding changes (move these root configs from |
Maybe we take the second approach and @paulrobertlloyd can manually specify these roots. Is providing 2 more constructor parameters |
Sounds good to me! I assume this is something 11ty would do, taking the values for |
Yes, I believe so. I mean before 11ty can manage to change accordingly, can you use this LiquidJS feature directly so this regression unblocks your work? |
Oooh, I understand. I can use my own Liquid instance with 11ty again and use these new options, certainly. Might me doing so be a good way to test this is a good approach, as well? |
# [9.27.0](v9.26.0...v9.27.0) (2021-10-03) ### Bug Fixes * remove "stream" dependency in browser bundles, [#396](#396) ([3b5eb66](3b5eb66)) * renderToNodeStream() now emit 'error' event instead of throw ([afeef1d](afeef1d)) ### Features * add `layouts`, `partials` apart from `root`, [#395](#395) ([b9ae479](b9ae479)) * renderFileToNodeStream(filepath, scope) ([68c4cfc](68c4cfc)) ### Performance Improvements * make the most of streamed rendering ([aea3441](aea3441))
Hmm, not sure if this is working. With the following options: new Liquid({
extname: '.liquid',
layouts: './src/layouts',
partials: './src/includes',
}); I get the following error: [11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] > Having trouble rendering liquid template ./src/content/articles/1999-03-01-early_graphic_design_in_television.md
`TemplateContentRenderError` was thrown
[11ty] > ENOENT: Failed to lookup "photos" in ".", file:./src/content/articles/1999-03-01-early_graphic_design_in_television.md, line:44, col:1
`RenderError` was thrown
[11ty] > ENOENT: Failed to lookup "photos" in "."
`Error` was thrown:
[11ty] Error: ENOENT: Failed to lookup "photos" in "."
at Loader.lookupError (/Users/paulrobertlloyd/Sites/paulrobertlloyd-v4/node_modules/liquidjs/dist/liquid.node.cjs.js:847:21)
at Loader.lookup (/Users/paulrobertlloyd/Sites/paulrobertlloyd-v4/node_modules/liquidjs/dist/liquid.node.cjs.js:832:20)
at lookup.next (<anonymous>)
at reduce (/Users/paulrobertlloyd/Sites/paulrobertlloyd-v4/node_modules/liquidjs/dist/liquid.node.cjs.js:913:25) However, I get no errors if I set an array of directories for new Liquid({
extname: '.liquid',
root: ['./src/layouts', './src/includes'],
}); |
Canary 45 will use liquid 9.27.x—I’ll push this out today |
Oh, hmm—maybe it will, looks like we had some liquidjs regressions in our test suite |
Eleventy specifically only uses the compile time options to pass in the input file path to support relative includes e.g. Is there a better way to do this? |
Just as info, it looks like 9.26 introduced regressions specifically with the issues documented above which are being picked up by all of the 1.0 canaries (we tied to Here are the failures I’m seeing:
|
## [9.27.1](v9.27.0...v9.27.1) (2021-10-04) ### Bug Fixes * directory info in lookupError message, [#395](#395) ([92bfc65](92bfc65))
It works on integration tests, not sure where's the difference. Just added a demo for Lines 7 to 11 in 92bfc65
@paulrobertlloyd BTW, the above error
@zachleat can be done by setting to Maybe it's cleaner to be implemented in LiquidJS, what do you think? |
This is still not working with 9.27.1… I get the same error. Do I need to set |
The demo here seems working https://github.com/harttle/liquidjs/tree/92bfc65e0b1d937c00a8368b272223c702132d23/demo/nodejs Could you provide a minimal codebase to reproduce? I guess there's something with 11ty, maybe it's setting |
Ah, maybe changing settings even in a custom instance don’t affect how 11ty then handles LiquidJS internally. I’ll wait for the downstream update 🙂 |
- `relativeReference` is enabled by default, set to `false` to disable - Referenced files are still constrained within root/partias/layouts - fix: relative filenames are not constrained (which allows arbitrary filesystem read) Example Usage: {% render "../foo/bar.html" %} Note: ../foo/bar.html' should also be within `partials` (or `root` if `partials` not set)
# [9.28.0](v9.27.1...v9.28.0) (2021-10-06) ### Bug Fixes * skip root check for renderFile() ([822ba0b](822ba0b)) * support timezoneOffset for date from scope, [#401](#401) ([fd5ef47](fd5ef47)) ### Features * `relativeReference` for render/include/layout, [#395](#395) ([a3455eb](a3455eb)) * implement `forloop.name` as found in ruby shopify/liquid ([6dc7fad](6dc7fad))
Add support on v9.28.0 for relative reference. Things like following are now natively supported: {% render ../foo/bar %}
{% layout ./bar %} Note that relatively referenced files are also need to be within corresponding root. |
Can confirm that using |
I appreciate the movement here but I do think this was a semver breaking change, right? Are we not allowed to use Should this have been bundled with a major version API change? |
Disregarding that, I think moving forward we will need a way to do relative includes that re-use the e.g.
should look in:
(and any additional directories you specified in |
I made a mistake thinking that argument is only used by myself in
I agree, let me check that. And..The second argument should be a full path. By passing in a template string, we'll not look up the filepath specified by second argument. That means |
Added 2 test cases for demo: liquidjs/test/integration/liquid/liquid.ts Lines 117 to 138 in 1de6adf
|
Just looking at the docs, I think I was a bit harsh! I don’t think you put the third argument there into your API docs—so I’m not sure how I found it. Thank you for the help resolving this though! |
Just retested in 9.28.2 and still have a bunch of very basic regressions with lookup directories on the |
I am also seeing issues with render and include still. Any status on this? |
@jaredwray There is a breaking change here, opts for render() is no longer available. There may be other bugs, so please post the exact issue and let's see what we can do to fix that. I'm also willing to help :) If it's not viable for you to incorporate this change and fix the issues, I suggest lock LiquidJS to its minor version. |
@harttle - if opts for render is no longer available I will just remove that from the system. Is |
In the latest version, there's a bug in |
@jaredwray FYI: this bug is fixed on 9.28.3 if there's still any issue, feel free to post it back. |
@harttle - thanks will check this out soon. |
The fix for this has made it into Eleventy master and will ship with 1.0.0-beta.5. Tracking at 11ty/eleventy#1995 Thank you @harttle for the PR! |
Updating the dependencies for my Eleventy-based website (currently using v1.0.0-canary.44), and updating LiquidJS from v9.25.1 to v9.26.0 generates the following error:
As to some background, I have Eleventy set up to look for includes and layouts in separate specified folders. At the top of my templates, I extend a common
default.liquid
template, i.e.:Eleventy looks for this default template in
./src/layouts/
, but since updating to the latest version of LiquidJS, it appears to now be looking for it in/src/includes/
. Reverting to v9.25.1 of LiquidJS prevents this error from occurring. Looks like there was a bit of refactoring in the most recent release, which may be the culprit!Happy to provide more details if required. My site’s code can be found at https://github.com/paulrobertlloyd/paulrobertlloyd-v4
The text was updated successfully, but these errors were encountered: