Last active
September 22, 2018 14:28
-
-
Save Zertz/8347dbd5faef3ec8d7c9b477806a2d94 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
async function handleRequest(request) { | |
const response = await fetch( | |
request.url.replace("https://fonts.jirafe.io", "https://fonts.googleapis.com"), | |
request | |
); | |
const css = await response.text(); | |
return new Response(css.replace(/}/g, "font-display: swap; }"), { | |
headers: response.headers | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment