Anyone else just HATE styling?

Page 3 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Cerb

Elite Member
Aug 26, 2000
17,484
33
86
Right, so you compile your JS into a single file. Instead of pulling down 50 files in sequence, you pull down one.
Also, remove the argument. Even with pipelining, that indicates to the browser that the request is stateful. Many JS files works for a lot sites just fine, since they get cached on the first load (worse than optimized into one file, but serviceable, especially if you want to optionally use a CDN).
 

Leros

Lifer
Jul 11, 2004
21,867
7
81
Also, remove the argument. Even with pipelining, that indicates to the browser that the request is stateful. Many JS files works for a lot sites just fine, since they get cached on the first load (worse than optimized into one file, but serviceable, especially if you want to optionally use a CDN).

I agree about removing the argument. A better approach is to dynamically alter the path based on the file contents (e.g. "/statics/<file-hash>/file.ext"), so that the path changes whenever the file changes. With this method, you get caching and you don't run into caching problems when the files change.

I disagree about multiple JS files working. Users will click away from a site if it takes more than 300-500ms to load. The time for that first page load is really important. Consolidating your javascript files can have the effect of decreasing your bounce rate.
 
Last edited:

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,698
4,659
75
YSlow recommends moving all JS file references to the bottom of your HTML, so they won't interfere with page loading. There's also the newer asynchronous loading style.
 

Cerb

Elite Member
Aug 26, 2000
17,484
33
86
I disagree about multiple JS files working. Users will click away from a site if it takes more than 300-500ms to load. The time for that first page load is really important. Consolidating your javascript files can have the effect of decreasing your bounce rate.
Many JS files after the content allow the page to be viewed even before "</body>" is received, regardless of how many JS files there are. It works fine on major websites all the time, usually using a popular CDN (I'm sure that's one of the reasons they do it, instead of consolidating). If it takes 150ms o get to that point (probably typical), then the page is well within a 500ms window.
 

Chaotic42

Lifer
Jun 15, 2001
34,804
1,985
126
I can't stand web development in general.

I agree, and I haven't done a whole lot of it. A few Flex sites was enough. CSS/HTML itself isn't so bad, but my idea of what looks good doesn't usually match up with what customers want.