You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently only the end-user of a metalsmith build can choose to do post-processing on the build.
Use cases:
Plugins like metalsmith-debug-ui add dynamically generated files to the build that are not intended for plugin processing. Providing such an event would allow them to do this safely without requiring user tweaks with pattern-matching in subsequent plugins
This event would also allow plugins to encapsulate command-line tools (like exiftool or 7zip) to run on metalsmith.destination() with the guarantee that files have already been written
Given that plugins have access to the files object and it is passed by reference, care should be taken in the docs to discourage altering or overwriting user files in these event listeners (or Object.freez'ing it?). The listeners should be executed sequentially, and should properly handle async (maybe use another Ware instance?)
Sample usage:
// adding a dynamically generated file not intended for processingmetalsmith.use((files,metalsmith,done)=>{metalsmith.on('built',asyncfiles=>{constfile={contents: awaitfsPromises.readFile('dynamically-generated.html','utf-8')}files['dynamically-generated.html']=file})})// running a command after completionmetalsmith.use((files,metalsmith,done)=>{metalsmith.on('built',()=>{execSync('ls -la',{cwd: metalsmith.destination()})})})
The text was updated successfully, but these errors were encountered:
Currently only the end-user of a metalsmith build can choose to do post-processing on the build.
Use cases:
metalsmith.destination()
with the guarantee that files have already been writtenGiven that plugins have access to the files object and it is passed by reference, care should be taken in the docs to discourage altering or overwriting user files in these event listeners (or Object.freez'ing it?). The listeners should be executed sequentially, and should properly handle async (maybe use another
Ware
instance?)Sample usage:
The text was updated successfully, but these errors were encountered: