kalamuna / metalsmith-jstransformer

Metalsmith JSTransformers Plugin
http://npm.im/metalsmith-jstransformer
MIT License
7 stars 9 forks source link

Fix Metalsmith Watch Support #31

Open fortes opened 7 years ago

fortes commented 7 years ago

Thanks for this plugin, I have recently moved from metalsmith-in-place and metalsmith-layouts over to just metalsmith-jstransformer (run in two passes, one for markdown w/o layout and then the second w/ layouts).

Everything works great the first time, but if you're using metalsmith-watch and edit a file, the file will then lose layout on all subsequent builds until you kill the process and restart.

The repro is pretty simple, you can see it here in this gist: https://gist.github.com/fortes/eac83cfcc025e5f5afc4dd0c80e4741c

To run locally: git clone https://gist.github.com/eac83cfcc025e5f5afc4dd0c80e4741c.git repro and see the instructions in README.md

RobLoach commented 7 years ago

You're right, and thank you for the nice testing platform for it.

Moved your repo over to https://github.com/RobLoach/metalsmith-jstransformer/pull/32 so that we can test it more thoroughly. Watch may forget the existance of the layouts, so it doesn't re-apply them on the second build.

fortes commented 7 years ago

Thanks for taking a look, let me know if there is anything I can do to help.

RobLoach commented 7 years ago

Not sure where metalsmith-watch stores its cache. We may need to go into its inards and figure out what's going on.