Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch mode doesn't watch all files #289

Open
joenye opened this issue Sep 20, 2020 · 4 comments
Open

Watch mode doesn't watch all files #289

joenye opened this issue Sep 20, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@joenye
Copy link

joenye commented Sep 20, 2020

It seems only changes to *.md files will be watched. For example, changes to images will not be watched.

Steps to reproduce

  1. Create a simple index.md that references image.png on a slide.
  2. Execute marp -psw .
  3. Change index.md -> Preview updates ☑️
  4. Change image.png -> Preview does not update ❎
@yhatt
Copy link
Member

yhatt commented Sep 20, 2020

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.

@yhatt yhatt added the enhancement New feature or request label Sep 20, 2020
@joenye
Copy link
Author

joenye commented Sep 20, 2020

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.

@yhatt
Copy link
Member

yhatt commented Sep 20, 2020

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.

@simoneggler
Copy link

this would be a really helpful feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

3 participants