@@ -433,6 +433,44 @@ translated, here's what to do:
433
433
434
434
.. _Django i18n mailing list: http://groups.google.com/group/django-i18n/
435
435
436
+ Submitting javascript patches
437
+ =============================
438
+
439
+ .. versionadded:: 1.2
440
+
441
+ Django's admin system leverages the jQuery framework to increase the
442
+ capabilities of the admin interface. In conjunction, there is an emphasis on
443
+ admin javascript performance and minimizing overall admin media file size.
444
+ Serving compressed or "minified" versions of javascript files is considered
445
+ best practice in this regard.
446
+
447
+ To that end, patches for javascript files should include both the original
448
+ code for future development (e.g. "foo.js"), and a compressed version for
449
+ production use (e.g. "foo.min.js"). Any links to the file in the codebase
450
+ should point to the compressed version.
451
+
452
+ To simplify the process of providing optimized javascript code, Django
453
+ includes a handy script which should be used to create a "minified" version.
454
+ This script is located at ``/contrib/admin/media/js/compress.py``.
455
+
456
+ Behind the scenes, ``compress.py`` is a front-end for Google's
457
+ `Closure Compiler`_ which is written in Java. However, the Closure Compiler
458
+ library is not bundled with Django directly, so those wishing to contribute
459
+ complete javascript patches will need to download and install the library
460
+ independently.
461
+
462
+ The Closure Compiler library requires Java version 6 or higher (Java 1.6 or
463
+ higher on Mac OS X). Note that Mac OS X 10.5 and earlier did not ship with Java
464
+ 1.6 by default, so it may be necessary to upgrade your Java installation before
465
+ the tool will be functional. Also note that even after upgrading Java, the
466
+ default `/usr/bin/java` command may remain linked to the previous Java
467
+ binary, so relinking that command may be necessary as well.
468
+
469
+ Please don't forget to run ``compress.py`` and include the ``diff`` of the
470
+ minified scripts when submitting patches for Django's javascript.
471
+
472
+ .. _Closure Compiler: http://code.google.com/closure/compiler/
473
+
436
474
Django conventions
437
475
==================
438
476
0 commit comments