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

Automatic reloading when any source file has changed, not just the top-level file #662

Closed
KarelPeeters opened this issue Feb 7, 2024 · 2 comments

Comments

@KarelPeeters
Copy link

KarelPeeters commented Feb 7, 2024

The plugin currently reloads the source file at a configurable frequency, and if the contents have changed the file is recompiled and rendered again. This works well if the there is only a single root file, but once include:: directives are used this is not ideal. Any edits to non-root files are only rendered when the root file contents change.

The current logic is at the bottom of loader.js, concretely in startAutoReload for the timer and fetching the root source, and reloadContent for checking if the root content has changed via an md5 hash.

I would suggest changing this slightly to fetching all included files, comparing all of them to their cached hashes, and recompiling if any of them have changed. There is no edge case to consider around newly included files, since this always requires a change in an existing file, so this will already be picked up correctly. Files being deleted can also be handled easily.

If all of this sounds reasonable and no one else is working on this yet, I'd be happy to submit a PR for this.

@ggrossetie
Copy link
Member

I guess this is a duplicate of #503 ?

@KarelPeeters
Copy link
Author

Ah indeed, my bad.

I'll start working on a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants