-
Notifications
You must be signed in to change notification settings - Fork 0
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
Integrate Eleventy Universal Filters, Shortcodes, and Paired Shortcodes #9
Comments
Sorry, I’m a little confused—isn’t this already implemented with eleventy-plugin-vento/VentoPlugin.js Lines 97 to 102 in 6590ff6
|
Ah, I think I see what you’re asking—you just want a less brittle way of doing it—right? I think we can accommodate that |
Yessir, if possible! Or at the very least an "official" recommendation on approach if you have one; even if that's "DIY, you're on your own" 😅 Looks like you do some |
…ortcodes and filters to establish this.page and this.eleventy (and future props too) Related to #3310 and noelforte/eleventy-plugin-vento#9
Related 11ty/eleventy#3355 let me know if that could be improved, I’m not super happy with it though it is less brittle than DIY |
@zachleat first off thank you for offering your time to address this upstream. Here's some observations I've made after several hours of trying, failing, and finally succeeding in using As you saw, I loop through all filters per template compiled and add context to each, I'm not sure whether there's a more efficient way to do it, but there it is. My first attempt was calling eleventy-plugin-vento/VentoPlugin.js Lines 81 to 86 in 05f6f85
Regardless, that didn't work because What did end up working for me was supplying eleventy-plugin-vento/VentoPlugin.js Lines 81 to 84 in 29de5e6
Again, I have no idea if this was how you imagined this method being used, and it's more than likely I'm missing something critical here. I reviewed the example you provided for Nunjucks and had trouble seeing how I would apply it to my use case. Only if you have the time, I'm curious to hear if where I arrived was what you envisioned. Given the API differences from engine to engine in core, and that the implementation for shortcodes/filters differs with core vs plugins maybe it is simpler to just have custom engines handle Sorry for the lengthy response, hope it helps identify any improvements that could be made! |
@zachleat I took another look at what I wrote and realized that in the context of wrapping the filters with a function, I took another pass at my implementation with eleventy-plugin-vento/VentoPlugin.js Lines 85 to 93 in 8697ce9
My only other piece of feedback is that wrapping functions with functions, etc. feels a bit clunky. Would it be possible to expose props in some way on custom template engines so that plugin authors could pick those up and bind to |
With the addition of 11ty/eleventy#3310, it should now be possible to fully integrate Eleventy's template features (filters, shortcodes, paired shortcodes) into this plugin.
Only outstanding thing that still needs to be worked out is the appropriate way to add page context (
this.page
/this.eleventy
) correctly. The approach in 11ty/eleventy#3081 (comment) could work by extending theTemplateEngine
class, or perhaps by doing some other sort of wheel-reinvention to achieve context availability in shortcodes, filters, etc.The text was updated successfully, but these errors were encountered: