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

Read from cache when watching #47

Open
groenroos opened this issue Aug 22, 2024 · 1 comment
Open

Read from cache when watching #47

groenroos opened this issue Aug 22, 2024 · 1 comment

Comments

@groenroos
Copy link

Is it possible to configure fetch to always load from remote when doing the initial build (effectively duration: '0s'), but then always read from cache when the site is re-built via live reload (i.e. when running Eleventy with the --watch flag)?

We're using fetch to get content from an external CMS, and while always fetching the latest data in the initial build is important (so we have the latest content to work against), I'd want subsequent live re-builds to read from cache, so that some simple template tweak doesn't take 14s+ to build when every CMS endpoint is hit again.

@Zegnat
Copy link
Contributor

Zegnat commented Sep 4, 2024

I do not think eleventy-fetch can see what is going on build-wise.

But would this be solved by making sure you empty the cache folder before you start the build? Then it should only fill the cache once at the start. You could use something like rimraf right at the start of your build-watch process.

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