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

lume server doesn't reset computed extraData #109

Closed
fserb opened this issue Jun 21, 2021 · 4 comments
Closed

lume server doesn't reset computed extraData #109

fserb opened this issue Jun 21, 2021 · 4 comments

Comments

@fserb
Copy link
Contributor

fserb commented Jun 21, 2021

I have a plugin that does a Table of Contents based on Headings (h1, h2, h3... instead of tags). For this, I process() each page and extract the headings. All is good and it works fine.

The problem comes when I run lume in server/watch mode.
In that case, there doesn't seem to be way to "reset" the TOC and not double it at every reload, since I need to keep it global to all pages.

If I try as a global list, it obviously doesn't get cleared.
But if I try as part of site.extraData, it also doesn't get cleared.

I think it might be overkill to have a site.rebuild(callback), but it feels like this should have a proper solution? I tried using events, but beforeBuild is not called all the time and beforeUpdate only reload some files. My current solution is to find a way to update the TOC instead of adding to it.

(related, but not really, it would be really nice to have a --watch option that does only watch/rebuild and no HTTP server)

@oscarotero
Copy link
Member

Can I see the plugin? I think the event you need it beforeUpdate, that is triggered just before every new rebuild, but maybe if I take a look to the plugin I can help you to find the best solution.

And about the --watch option, why do you need this? Do you want to use a different HTTP server or you don't need a server at all?

@fserb
Copy link
Contributor Author

fserb commented Jun 22, 2021

For the --watch, yes. I have a nginx running that has HTTPS on my local machine.

It's also a bit annoying if I do my own file watch and rerun Lume, because i's a bit slow to redo everything (and copy files, etc) (like 1s as opposed to a 100-200ms).

(nevermind the original bug here)

@oscarotero
Copy link
Member

(nevermind the original bug here)

Ok, I just looked your plugin and have some thoughs, but if you already solved it, ok :)

And about the --watch, it's easy to implement so I'll add it in the next version.

@fserb
Copy link
Contributor Author

fserb commented Jun 22, 2021

(thank you so much for the --watch)

@fserb fserb closed this as completed Jun 22, 2021
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