North America - English

League of Legends Community

League of Legends Community > Feedback > PVP.net Discussion
[Site Suggestion] Place styling in separate CSS file

 
Comment below rating threshold, click here to show it.
The GZA ?? Member
This user has accepted the summoners code, click for more information
11-23-2010

Appologies if this is in the wrong forum. Since there is no Site Feedback forum, I figured this was the most appropriate place.

I noticed when viewing the source html of threads, the entire style block was right in the html. That's about 38kb of data being sent EVERY request! It could benefit greatly to place this all in a css file and just reference it on the page. That way, the browser could cache the css, which would save a substantial amount of bandwidth.

 
Comment below rating threshold, click here to show it.
iMumbleAlot ?? Senior Member
This user has accepted the summoners code, click for more information
11-28-2010

this is probably(read definitely) a dynamically generated page probably using ruby on rails or php, the css is probably also dynamically generated so is potentially different on each load.

 
Comment below rating threshold, click here to show it.
The GZA ?? Member
This user has accepted the summoners code, click for more information
11-28-2010

Static files would work just fine if changes are made to the styling. If I understand correctly, when a browser caches the file, some meta data is still sent back and forth every load, and if it determines that the file has been changed, it will re-download the file, but will avoid it if the file hasn't been changed. I think the benefits of 30-40% less data being sent would far outweigh the time required to make adjustments to whatever it is they use for creating the site. I'm not familiar with php, or rails, but I'm willing to bet there is a way to use css files with it.

 
Comment below rating threshold, click here to show it.
Johis ?? Member
This user has accepted the summoners code, click for more information
11-28-2010

Quote:
Originally Posted by The GZA View Post
Static files would work just fine if changes are made to the styling. If I understand correctly, when a browser caches the file, some meta data is still sent back and forth every load, and if it determines that the file has been changed, it will re-download the file, but will avoid it if the file hasn't been changed. I think the benefits of 30-40% less data being sent would far outweigh the time required to make adjustments to whatever it is they use for creating the site. I'm not familiar with php, or rails, but I'm willing to bet there is a way to use css files with it.
Of course there is. Ruby can plug in to PHP, and both are capable of editing a text file before it is sent to the client. This is usually not the ideal approach, though. It's generally preferred to simply have multiple static files and to serve the file based on the user's selected preference (from a list of specific options). This site doesn't change all that much, though, and it doesn't give users the flexibility to customize styling to a really relevant degree. It should be easy to use a few static files that can be cached. Then just change the file names when they are edited to force older browsers to recache.

 
Comment below rating threshold, click here to show it.
The GZA ?? Member
This user has accepted the summoners code, click for more information
12-15-2010

Bump

I've tried running Fiddler to see exactly what's coming in, and it's definitely ALL css EVERY page request. Most forum pages are roughly 100-120kb. That could easily be dropped to 70-8kb just by moving the css to a separate file!