Originally discussed in https://github.com/Keats/gutenberg/pull/379, Gutenberg should have the ability to fetch data from remote endpoints, whether this be in JSON, CSV, TOML, or indeed plaintext.
The API should be very simple, which would allow for a large amount of code reuse, as defined in https://github.com/Keats/gutenberg/pull/379#issuecomment-415892025. Simply swapping out the path parameter for url can switch between remove and local data file fetching. There's no reason we need anything more complicated than that.
I'm more than happy to do the fix, porting the work I did in https://github.com/Keats/gutenberg/pull/465 to @kellpossible 's implementation. Creating this issue to track the feature request, and related discussions.
sounds good!
The local version is in next now. I think it would be necessary to cache both local/remote serialized data in the Tera function to avoid loading all the time while running serve
Sweet! I'll get working on this over the weekend!
Agreed we need a cache. Caching URLs can be based on the full URL, but what exactly can the key be for data files? If we're allowing data files to live reload (do we?), then reading every data file each time feels somewhat unnecessary. Although maybe hashing off path and modified time isn't enough?
I'll have a play around, see what comes out.
I don't think we need to live reload local files, it seems like a niche case of a niche case. If it's easy to add by hashing the modified time though, let's do it though.
Looks like this can be closed now as per #494?
Yes, this is done.