jezdez/django_compressor — Issue #193: ideas: lazy compress, media include tag, and precompile media
Author: pegler
Created: 2012-01-11 19:31:46+00:00
State: open

I am currently using dango-compressor and subclasses some stuff to enable what I call lazy compression. Basically I have some template tags that allow me to add media files to the CSS and JS blocks. For example: {% add_media 'js' 'myfile.js' %} will add myfile.js to a set and then on my page I have {% block lazy-compress %}{% media_out 'js' %}{% endblock %}. It is lazy in that the compression wont be called until the lazy-compress template node is cast to a string/unicode. This allows me to add JS and CSS to the page from within my included templates. This makes having components with their own CSS and JS files easy to maintain because then I don't need to know all the components I will be using on a given page, each component adds its own media. I currently have this working well, but is not on a fork. Is this something that fits within django-compressor's scope? Meaning, is it worth my time to fork, write tests and do a pull request?

Additionally, my project is going to begin using coffeescript and less. I checked the docs, and from what I can tell, django-compressor does not currently keep compiled copies of files around for use in different minified media files. Is this accurate, or does it compile a file once, and then reuse it when it needs it? If it doesn't currently do this, I would like to suggest it be included in a future release, as it seems like it would be a significant performance boost.