Extract "default" template languages (Nunjucks, Liquid, markdown) to plugins #4303
Replies: 7 comments
-
|
Thank you 🧡 I think, one of the beautiful aspects of Eleventy is the support for multiple template languages (as well as their mix-and-match). This eases the transition from other systems to it (Jekyll using Liquid, Python with Jinja2 which is almost identical to Nunjucks etc). On the other hand there's this argument that by bundling all those template language engines the package download size goes up. Splitting it up might be a good strategy. In the past, several pieces have been moved into plugin land. |
Beta Was this translation helpful? Give feedback.
-
|
In regards to forming a core, eleventy has a lot of odd vestigial organs supporting languages like HTML, Markdown, Nunjucks and Liquid inside of what could be considered to be the current "core". This includes but is not limited to stuff relating to the following configuration options:
all of these functions internally either
There's no great reason why eleventy's core codebase should hold variables that essentially enshrine eleventy's default templating languages first class citizens. Removing all references to stuff like this in the core library and migrating them to a sort of "starter" project ensures that all templating languages have an equally robust plugin API, and improves perf for projects not using the starting stuff. Examplee.g. in the case of templating language specific filters/shortcodes, migrate to universal filters. If supporting language-specific filters is desirable, a new param can be added to // though of course this function shouldn't exist in core, @eleventy/starter may want to implement it
function addNunjucksFilter(name,callback) {
// third param refers to a given template format's name
this.addFilter(name,callback,"njk")
}DetailsConformance to this looks like Probably, if I was to do this, I would do the following
If nobody else does, I will give this a try n months in the future where n represents when my current workload subsides |
Beta Was this translation helpful? Give feedback.
-
|
I’m concerned that moving more of Eleventy’s core functionality into plugins creates a barrier for anyone wanting to use Eleventy that is not already familiar with Node — especially people who are relatively new to programming. Batteries included is really helpful for newcomers. |
Beta Was this translation helpful? Give feedback.
-
|
Did you see my comment about splitting into two packages? That might also sort of exist now with what @zachleat has been doing with multiple bundles for v4 - not sure if this change would fit in what he envisions but maybe a bundle without default template langs? |
Beta Was this translation helpful? Give feedback.
-
|
That’s certainly a better option than just removing all templating languages from Eleventy, but even so it introduces potential confusion for new users regarding which package they want. And I’m not entirely sure I understand the motivation for this change either. I understand wanting to shrink bundle sizes for libraries that are shipped to browsers to cut down on bandwidth and improve performance, but in the case of dependencies on your local machine, 3mb just doesn’t seem like that big of a deal to me. I feel like I need more context for when eliminating these dependencies is important. |
Beta Was this translation helpful? Give feedback.
-
|
Per the work in #3858 we could very easily extend the approach we used to publish |
Beta Was this translation helpful? Give feedback.
-
|
Converting this one to a Discussion. I think it’s still on the table to decouple these out but this is more of an internals thing as it’s unlikely we’ll remove any of the current default template syntaxes we support moving forward |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Originally posted by @uncenter in #3587
As suggested by @Ryuno-Ki, opening as a new issue for this discussion.
Since Eleventy tries to remain unopinionated, I think moving these template languages to separate plugins in https://github.com/11ty/eleventy-plugin-template-languages would make sense. If it is felt that including (a) default template language(s) is important (i.e. new users, simplified configuration/setup - valid points), I would propose splitting Eleventy into two packages;
@11ty/coreand@11ty/eleventy, the former being a more barebones scaffolding tool and the latter coming with more defaults and reinforced structure. Just a thought :)Beta Was this translation helpful? Give feedback.
All reactions