Inspired by http://www.djangosnippets.org/snippets/712/

This loads in css and javascript files where you want them (usually in the head) - but allows you to put them anywhere in your code - i.e. in a TemplateTag.

so your head code will look like this:

<head> ... <!-- HEAD_init --> ... </head>

then somewhere in your templates you can load in javascript or css files like so:

<!-- HEAD_include myfile.js myotherfile.css -->

It automatically checks if you've already included the files, and only puts them in once. It automatically figures out if its a javascript or css file by the file name - If you have an irregular filename (i.e. a google maps api script url) you can force it by using either of the following tags:

<!-- HEAD_include_js [my javascript file] --> <!-- HEAD_include_css [my css file] -->

Or you can write inline code to get rendered in the head:

<!-- HEAD_render <script> someJavascriptCall(); </script> -->

Todo: make it compress the js into one file...