Skip to content

Instantly share code, notes, and snippets.

@jmak
Created June 27, 2019 09:43
Show Gist options
  • Save jmak/f3120d73ba1ed390a629c2a6ecf82996 to your computer and use it in GitHub Desktop.
Save jmak/f3120d73ba1ed390a629c2a6ecf82996 to your computer and use it in GitHub Desktop.
Similar to the media toggle approach, we could also load CSS asynchronously by marking a link as an alternate stylesheet (designed to offer the user alternate presentations of a site), and then using JavaScript to toggle the rel attribute back to stylesheet when the file loads:
<link rel="preload" href="mystyles.css" as="style" onload="this.rel='stylesheet'">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment