posthtml / metalsmith-posthtml

PostHTML for Metalsmith
MIT License
6 stars 2 forks source link

Calls Metalsmith callback too many times #40

Open mdekstrand opened 6 years ago

mdekstrand commented 6 years ago

Problem

The plugin calls the Metalsmith callback once for each file processed, instead of once when file processing is complete.

This results in many problems, one of which is allowing other Metalsmith plugins to run and modify the files (or delete or rename them!) while PostHTML page processing is happening.

This is manifesting as unhandled rejected promises, and I traced it to the incorrect use of the Metalsmith callback.

Scrum commented 6 years ago

@mdekstrand Hi, please show the error and best of all an example of reproducing this error, and even better place it in the repository. Thank you.

mdekstrand commented 6 years ago

Here is the error:

TypeError: Cannot set property 'contents' of undefined
    at require.process.then (C:\Users\michaelekstrand\Documents\md.ekstrandom.net\node_modules\metalsmith-posthtml\index.js:23:32)
    at <anonymous>

I don't currently have a minimal reproducer, though I have identified the specific problem in the metalsmith-posthtml code.

Scrum commented 6 years ago

unfortunately I could not reproduce this error demo, more information is needed. If there is still information on this error, please be sure to know or try to reproduce it in the demo

Thanks in advance