Skip to content

Commit fab05ca

Browse files
Change how JS libs are loaded
This change makes Django-Debug-Toolbar use the existing version of jQuery on the page if one exists, and only loads jQuery if it isn't already loaded. It also explicitly loads the jQuery cookie plugin and the toolbar script as separate files. Finally, we are no longer compressing/minimizing scripts; this is for debug purposes, and presumably will not be served in production.
1 parent 3d643e2 commit fab05ca

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ coverage:
2222
coverage run --branch --source=debug_toolbar `which django-admin.py` test tests
2323
coverage html
2424

25-
compress_js:
26-
yuicompressor debug_toolbar/static/debug_toolbar/js/jquery.js > debug_toolbar/static/debug_toolbar/js/toolbar.min.js
27-
yuicompressor debug_toolbar/static/debug_toolbar/js/toolbar.js >> debug_toolbar/static/debug_toolbar/js/toolbar.min.js
28-
2925
compress_css:
3026
yuicompressor --type css debug_toolbar/static/debug_toolbar/css/toolbar.css > debug_toolbar/static/debug_toolbar/css/toolbar.min.css
3127

debug_toolbar/static/debug_toolbar/js/toolbar.min.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

debug_toolbar/templates/debug_toolbar/base.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
@media print { #djDebug {display:none;}}
44
</style>
55
<link rel="stylesheet" href="{{ STATIC_URL }}debug_toolbar/css/toolbar.min.css" type="text/css" />
6-
<script type="text/javascript" src="{{ STATIC_URL }}debug_toolbar/js/toolbar.min.js"></script>
6+
<script>window.jQuery || document.write('<script src="{{ STATIC_URL }}debug_toolbar/js/jquery.js"><\/script>')</script>
7+
<script src="{{ STATIC_URL }}debug_toolbar/js/jquery.cookie.js"></script>
8+
<script src="{{ STATIC_URL }}debug_toolbar/js/toolbar.js"></script>
79
<div id="djDebug" style="display:none;" dir="ltr" {{ TOOLBAR_ROOT_TAG_ATTRS|safe }}>
810
<div style="display:none;" id="djDebugToolbar">
911
<ul id="djDebugPanelList">

0 commit comments

Comments
 (0)