eleventy-fetch
eleventy-fetch copied to clipboard
Pass in a custom fetching function rather than a URL
Howdy! I think it would be really nice if I could pass in a function that fetches my data from the target URL, rather than passing in the URL directly. For my use case specifically, I want to pull in data from the GitHub API at build time using their Octokit helper library. It's definitely possible to make requests by hand by assembling a request URL, but it's not as ergonomic (plus, Octokit allows you to aggregate paginated calls without needing to do this yourself). Is this something this plugin could accommodate? Maybe it would just need to accept a user-supplied key for caching since it's no longer getting a URL directly.
I think implementing this would provide a solution to https://github.com/11ty/eleventy-fetch/issues/2.