-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fetching data #864
Comments
Hey, thanks! That’s a good question—I didn’t really cover that in the documentation. So one way to go about fetching data from a remote source is to write a script that fetches the data, writes JSON files to the data folder, and then run it before you build/serve, something like: I’ve done that on a few projects and it works well if the data in the remote source is infrequently updated, but it doesn’t work well if you’re changing the data in the remote source a lot, because every time you change it you’ll need to kill the server and start it up again (or run the Someone in another issue mentioned the idea of allowing data files to be So maybe I need to both support JS data files and add documentation explaining the two ways of fetching data and their tradeoffs, then users can decide which one to use depending on how frequently they think their data will change. What do you think? |
I believe is a good idea to implement js files as data sources (additionally to JSON files). The function can be memoized (https://en.wikipedia.org/wiki/Memoization) so the performance is improved. But this would depend on each user's implementation. 👍 As per getting remote dynamic data. The end result is just an html website. So you can always use vanilla js or similar helpers inside the |
Hi. Charge looks promising, but I'm not clear on fetching data. I noticed an emphasis on using JSON files for data, but does this project support fetching data from a CMS and creating a build with that data?
The text was updated successfully, but these errors were encountered: