The problem of optimizing delivery of css and javascript assets seems to get a fair amount of attention - there are 3 django apps I know of (django-assetpackager, django-compress and my old django-farstyle) and numerous templatetags and related code on django-snippets.
The old farstyle was, IMO, a good start, but lacked a lot of important features, and didn't work all too well. By the time I got around to improving it, django-assetpackager and django-compress were out, each with its own set of clever ideas and solutions. But neither of those worked well for my own use, and I felt that a new app combining the best (again, IMO) features from all 3 apps would be far from redundant. The result is the new farstyle, just committed to svn at <http://code.google.com/p/django-farstyle/ > - with some ideas and code borrowed, with gratitude, from both afore-mentioned apps. From the project site: Farstyle simplifies the management and serving of CSS and JavaScript asset files. Required css or js files, conveniently defined and ordered in the database, are merged and compressed, then inserted into your HTML using a single templatetag. Unique file name used for merged asset files enable far-future caching, with a change in any file causing a new merged asset file to be generated and loaded by browsers. The merging and optimization process is fully customizable, offering control over both the overall processing of merged assets, as well as the handling of each individual file. CSS and JavaScript files can be individualy exempted from merging or optimization, and custom conditions can be used to group and serve files as separate assets based on request parameters or optional templatetag variables. Farstyle also helps with the creation of CSS and JavaScript files, by allowing them to be rendered from Django templates. Farstyle searches for files in both template provider locations and static filesystem directories, creating the opportunity to override static files with same-name templates. For development, merging and optimization are disabled when DEBUG is set to True. In this case individual tags are created for each file, with an added query string parameter which ensures that changed files will always be reloaded by browsers. A bonus feature enables far future caching of media files, such as large images that rarely change. Main Features * Define CSS and JavaScript files in the database. Control the files' order, toggle merging/compression for each file, and write custom Python rules to determine when files are to be used. * Create CSS and JavaScript files using django templates. Use constants in your template-based CSS, defined in an optional settings module. Override static CSS and JS files with template-based versions (especially useful when combined with django-dbtemplates). * Include all defined CSS and JS files in your templates using a single templatetag (single tag for each asset type, with the provision for using multiple tags combined with conditional statements). * Create far-future-caching friendly image tags for large images that rarely change. * CSS and JS files are merged down to the smallest possible number of asset files to optimize loading, and are named using unique names which allow browsers to cache assets while immediately loading new versions when assets are changed. * Merged and optimized asset files are re-generated on demand when any of the original CSS or JS files are modified. * The Sites application is supported, using Many-to-Many relationships so that multiple sites can share common assets. Check it out, make up your mind about whether it's useful for you. Comments welcome. Itai --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---