-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When used in Eleventy, this adds more insight into image processing c…
…ost during build. Adds per-image image processing output when not in Eleventy’s quiet mode. Adds an after-build summary message.
- Loading branch information
Showing
9 changed files
with
163 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class BuildLogger { | ||
constructor() { | ||
this.hasAssigned = false; | ||
} | ||
|
||
setupOnce(eleventyConfig, beforeCallback, afterCallback) { | ||
if(this.hasAssigned) { | ||
return; | ||
} | ||
|
||
this.hasAssigned = true; | ||
|
||
eleventyConfig.on("eleventy.before", beforeCallback); | ||
eleventyConfig.on("eleventy.after", afterCallback); | ||
|
||
eleventyConfig.on("eleventy.reset", () => { | ||
this.hasAssigned = false; | ||
beforeCallback(); // we run this on reset because the before callback will have disappeared (as the config reset) | ||
}); | ||
} | ||
} | ||
|
||
module.exports = BuildLogger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters