Skip to content

Commit

Permalink
Upgrade helper for 11ty/eleventy#3327
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Jul 23, 2024
1 parent 1081e07 commit d583b70
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = function(eleventyConfig) {
// Full list of issues: https://github.com/11ty/eleventy/issues?q=milestone%3A%22Eleventy+3.0.0%22+is%3Aclosed+label%3Abreaking-change
eleventyConfig.addPlugin(require("./src/node-version.js"));
eleventyConfig.addPlugin(require("./src/explicit-config-file.js"));
eleventyConfig.addPlugin(require("./src/html-output-suffix.js"));

eleventyConfig.on("eleventy.after", () => {
console.log(chalk.blue(`[${pkg.name}] This plugin is intended for temporary use: once you’re satisfied please remove this plugin from your project!`));
Expand Down
18 changes: 18 additions & 0 deletions src/html-output-suffix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const chalk = require("kleur");
const pkg = require("../package.json");

// https://v2-0-1.11ty.dev/docs/languages/html/#using-the-same-input-and-output-directories
module.exports = function(eleventyConfig) {
eleventyConfig.on("eleventy.config", ({ config }) => {
if(!("htmlOutputSuffix" in config)) {
console.log(chalk.blue(`[${pkg.name}]`), chalk.blue(`NOTICE`), `The \`htmlOutputSuffix\` feature was removed. It doesn’t look like you were using it!`);
} else {
console.log(chalk.red(`[${pkg.name}]`), chalk.red(`ERROR`), `The \`htmlOutputSuffix\` feature was removed. Learn more: https://github.com/11ty/eleventy/issues/3327`);
}
})

// Input and output are the same
if(eleventyConfig.directories.input === eleventyConfig.directories.output) {
console.log(chalk.yellow(`[${pkg.name}] WARNING`), `Your input and output folders are identical so please take note that Eleventy 3.0 will throw an error if any of your output files attempt to overwrite your input files. Learn more: https://github.com/11ty/eleventy/issues/3327`);
}
};

0 comments on commit d583b70

Please sign in to comment.