(from https://medium.com/cs-math/f29f6080c131) Jammit came out of DocumentCloud, and even though it was built for Ruby on Rails you can do something like this and use it for Django pretty easily. One of the things I like about it is you can setup different named configurations for javascript and css for different sections of your site (dashboard, non-authenticated, standard). It supports lots of other stuff too.
This is how I use Jammit on NewsBlur: https://github.com/samuelclay/NewsBlur/blob/master/utils/jam.... I then compress the assets, upload to S3, and then deploy to my servers. See https://github.com/samuelclay/NewsBlur/blob/master/fabfile.p.... Each app server then downloads from S3. So I can package 2MB of static assets and deploy to to a hundred servers in 10 seconds.
<script src="{% static js/mylib.js %}"></script>
and with compress like this: {% compress js %}
<script src="{% static js/mylib.js %}"></script>
{% endcompress %}
so that referencing static files is consistent.[0]: https://github.com/jezdez/django_compressor
[1]: https://docs.djangoproject.com/en/dev/ref/contrib/staticfile...
I just enable gzipping and don't worry about minification of my own assets. Sure, it means larger initial downloads (since they're cached), but it's typically in the single digit kilobytes, and simplifies debugging like nothing else.
We used to use the HTML5 Boilerplate script but it was horrendously slow on EC2