Watch mode doesn't watch all files
It seems only changes to *.md files will be watched. For example, changes to images will not be watched.
Steps to reproduce
- Create a simple
index.mdthat referencesimage.pngon a slide. - Execute
marp -psw . - Change
index.md-> Preview updates :ballot_box_with_check: - Change
image.png-> Preview does not update :negative_squared_cross_mark:
Currently Marp CLI is observing the change only for Markdown file and theme CSS file because watching image resources using in Markdown requires extra parse step.
I think it's hard to implement, but also must have a worth.
Thanks for the quick response.
I see you're already using chokidar. One should be able to watch all files in the user-provided directory with this.
In the simplest case, one could reload the build/preview every time any file in that directory changes.
In the more sophisticated case, one could determine which files are referenced by *.md files and only reload when they change.
Yes. Probably we will take the simplest one at the first: should observe all files in specified directory by --input-dir / -I option.
In server mode, we are internally being inherited the passed directory to --input-dir option, so observer still will work in the server directory.
The fact we should consider is that the current watch mode can work in both of regular file conversion and server mode. When observer is working in regular conversion mode and the converted file was created into observed directory, we must avoid infinite loop.
this would be a really helpful feature