What is the critical rendering path?
- It is the series of events that must take place to render (display) the initial view of a webpage.
- Example: get html > get resources > parse > display webpage
CSS
- No more than one external CSS stylesheet of an reasonable size (less than 75k or so)
- Inline small CSS into HTML using style tags for above the fold content
- No @import calls for CSS
- No CSS in HTML things like your divs or your h1s (in element CSS)
Javascript
removing blocking javascript
<script type="text/javascript">
function downloadJSAtOnload() {
var element = document.createElement("script");
element.src = "defer.js";
document.body.appendChild(element);
}
if (window.addEventListener)
window.addEventListener("load", downloadJSAtOnload, false);
else if (window.attachEvent)
window.attachEvent("onload", downloadJSAtOnload);
else window.onload = downloadJSAtOnload;
</script>