Skip to content

Commit 96c7166

Browse files
committed
add warning for engine removals
Signed-off-by: Raphael Höser <[email protected]>
1 parent 0eb145d commit 96c7166

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/TemplateEngineManager.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class TemplateEngineManager {
7474
return !!this.getClassNameFromTemplateKey(name);
7575
}
7676

77+
isEngineDeprecated(name) {
78+
return ["ejs", "hbs", "mustache", "haml", "pug"].includes(name) && !this.hasEngine(name);
79+
}
80+
7781
async getEngineClassByExtension(extension) {
7882
// We include these as raw strings (and not more readable variables) so they’re parsed by a bundler.
7983
if (extension === "md") {
@@ -99,6 +103,16 @@ class TemplateEngineManager {
99103
}
100104

101105
async getEngine(name, dirs, extensionMap) {
106+
// Warning about engine deprecation
107+
// TODO: error message needs updating once issue is closed
108+
if (this.isEngineDeprecated(name)) {
109+
throw new Error(
110+
`Template Engine ${name} is removed in 11ty v3.0.
111+
If you want to vote for this engine to be re-added, vote on https://github.com/11ty/eleventy/issues/3124
112+
You can still add it as a custom engine: https://www.11ty.dev/docs/languages/custom/`,
113+
);
114+
}
115+
102116
if (!this.hasEngine(name)) {
103117
throw new Error(`Template Engine ${name} does not exist in getEngine (dirs: ${dirs})`);
104118
}

0 commit comments

Comments
 (0)