Snippet List
**Javascript merging and compression templatetag**
One of the most important things for improving web performance is to reduce the number of HTTP requests. This is a templatetag that merges several javascript files (compressing its code) into only one javascript.
It checks if this merged file is up to date, comparing modification time with the other javascripts to merge.
Usage:
{% load jsmerge %}
{% jsmerge mergedfile js/file1.js js/file2.js js/file3.js %}
The previous code will:
1. Search in `settings.MEDIA_ROOT` for all files passed by parameter.
2. Create a `/path/to/media_root/mergedfile.js` (if it doesn't exist or it's not up to date). This file is a merging plus compression of all javascripts.
3. Return this HTML fragment: `<script type="text/javascript" src="/media_url/mergedfile.js"></script>`
- javascript
- merging
- compression
- tunning
5 snippets posted so far.