Created
February 6, 2022 19:43
-
-
Save deckarts/ea1f965306e0ed76df13239599bb3fa0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const unblockCSS = () => ({ | |
element: (el) => { | |
el.removeAttribute('media'); | |
el.setAttribute('rel', 'preload'); | |
el.setAttribute('as', 'style'); | |
el.setAttribute('onload', "this.onload=null;this.rel='stylesheet';this.media='all'"); | |
el.after(` | |
<noscript><link rel="stylesheet" href="${el.getAttribute("href")}"></noscript> | |
`, { html: true }); }}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment