Fetches the contents of a HTML file as string.
The HTML file location.
The file content as a string.
Useful for loading HTML templates dynamically. You can use import.meta.resolve('./relative-path-to.html') to resolve paths relative to the current module.
import.meta.resolve('./relative-path-to.html')
const template = await fetchHtml('./template.html') Copy
const template = await fetchHtml('./template.html')
If the response is not ok.
MIME types
Fetches the contents of a HTML file as string.