This course has been updated! We now recommend you take the JavaScript Performance course.

Check out a free preview of the full Website Performance course:
The "YSlow Rules, Continued" Lesson is part of the full, Website Performance course featured in this preview video. Here's what you'd learn in this lesson:

Another rule of YSlow is to include your stylesheets at the top and scripts at the bottom. With scripts, remember that including them at the bottom simply gives priority to the rest of the markup. You may need to include your scripts at the top in situations where they become more important. Avoid CSS expressions because they will slow down the UI thread greatly. Also, externalize your JavaScript and CSS so they will take advantages of performance features like caching. Fewer DNS lookups will also increase performance by decreasing the latency of the page. Minifying JavaScript and CSS should be higher on the YSlow list because it’s an easy way to reduce the size of a web application. Avoiding redirects is another YSlow rule. An example is a website redirecting to the “www” version of the domain. When you are using the same JavaScript framework across a website, ensure you do not have duplicate script requests. ETags are hexadecimal codes generated for a particular resource. They function like a finger print to enable the conditional loading of that resource. Cacheable Ajax adds an additional layer of expiration on top any external resources you are loading. While these 14 YSlow rules can occasionally contradict each other, they are a basis for proper website performance.

Get Unlimited Access Now