We recently had some clients who wanted to get more speed out of HubSpot, but after going through our usual image optimization techniques and concatenating files they still weren't satisfied. We dug around and found out we could load CSS files asynchronously so that page rendering isn't blocked while the stylesheet loads. Here's how to do it:
<link rel="preload" href="link-to-stylesheet-here" as="style" onload="this.onload=null;this.rel='stylesheet'"/>
<noscript><link rel="stylesheet" href="link-to-stylesheet-here"></noscript>
<script>
/*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */
(function(){ ... }());
</script>
<link rel="preload" href="link-to-stylesheet-here" as="style" onload="this.onload=null;this.rel='stylesheet'"/>
<noscript><link rel="stylesheet" href="link-to-stylesheet-here"></noscript>
<script> /*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */ (function(){ ... }()); </script>
LoadCSS is a polyfill that allows us to load CSS asynchronously across all browsers. You can find the documentation here.