NewsBlur/utils/djangocompress/docs/Introduction.textile
2009-09-08 03:37:17 +00:00

21 lines
No EOL
1.8 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

h1. Introduction
_Short introduction to performance tweaks and what django-compress does_
JavaScript and CSS minification/compression can decrease load times of sites a lot.
It is important to reduce the number of requests that are made. Fewer files means better performance. However, when you develop CSS, and particularly if you are building a big site, it can be nice to separate different parts of the sites CSS into different files. You also want to keep the CSS and JavaScript in different files while you develop, to make debugging easier.
It is also nice to comment CSS and JavaScript, but you do not want the overhead of sending the comments and whitespaces to the clients.
You also want to make sure that as much of the static content is cached as much as possible at the client. The ideal is to even avoid “304 Not Modified” which are returned when a client requested something that has already been cached, and does not need to be updated. This can be accomplished by setting the HTTP Expire header to a date far in the future. That will force the browser not to ask for updates for that URL. However, when you need to update your files, you will need to give them a new URL, to push the updated files to the clients.
These techniques has been described more in depth at Yahoo:
* http://developer.yahoo.com/performance/rules.html#num_http
* http://developer.yahoo.com/performance/rules.html#minify
* http://developer.yahoo.com/performance/rules.html#expires
django-compress tries to address those issues with as little manual intervention as possible, whilst still being configurable enough to not get in your way. Read more about the [Features].
There are numerous of other techniques that could be used to improve performance, Yahoo has an excellent page that lists the most common:
* http://developer.yahoo.com/performance/rules.html