Managing CSS on large websites
I've recently begun working on a very large, high traffic website. We would very much like to reduce the size and number of our style sheets, minification is one route we will pursue but is anyone aware of any tools for checking ID and class use? Literally scanning the website to see what's active and what isn't?
开发者_开发问答Alternatively any software for redacting the css to reduce repition and size?
Thanks in advance
Literally scanning the website to see what's active and what isn't?
Dust-Me Selectors is a Firefox plugin that you can use to show what css rules aren't being used. http://www.sitepoint.com/dustmeselectors/
I can certainly recommend Page Speed (http://code.google.com/speed/page-speed/) by Google to check the performance (and possible improvements) of your webpages. Page Speed also checks CSS and usage of classes on your webpages.
It is used in combination with Firebug.
- Gzip compression in the webserver.
- Expiry dates that lie far in the future to avoid redownloading the CSS files.
Alternatively any software for redacting the css to reduce repition and size?
Yet another level of indirection ... You (and your team) should write long CSS files with as many comments as needed and then write a tool that will publish merged files as needed (different templates need different files), stripped comments and minified as http://www.cleancss.com could do (CSSTidy). Readability comes first if you wan't to be able to modify a file in 1 month or keep track of modifications (or worse if sb else must do that!).
Other options are to reduce the number of templates used throughout the site. No need of two templates with 2px differences (grid layouts are a good way to stick to this) or inconsistent ways of displaying error messages. Define a common look and feel to your site and give instructions to webdesigners, if it isn't already done.
精彩评论