Hi Tim,
Sorry for such a late response, I was caught up in the midterms.
The project idea is like this:
Right
now we have a Media class which is used to fetch the form assets but is not
very popular. In order to replace it with a new preprocessor, I see two
viable solutions:
1. Creating a new app 'static' in django.contrib with glean best practices from django-pipeline and django-compressor.
In
this option, all the assets need to be declared in STATIC_CSS and
STATIC_JS dicts in the settings for the different apps/scenarios just
like they have it in django-pipeline and these assets can be loaded in
templates as per requirements.
We can provide support for all the
major js and css compressors/compilers like CoffeeScript, LiveScript,
Closure, JsMin, Slimit, UglifyJS and YUI compressor for Javascript and
CssMIN and CSSTidy minifier for CSS by installing these compilers in
advance.
All the files that need to be minified can be mentioned in
source_filenames and the minified version will be generated as
STATIC_JS['output_filename'] after compilation during collectstatic.
For eg:
STATIC_JS = {
'main': {
'source_filenames': (
'coffee/app.coffee',
'js/*'
),
'output_filename': 'min.js',
},
}
STATIC_CSS = {
'main': {
'source_filenames': (
'stylus/main.styl',
'css/*',
),
'output_filename': 'main.css',
}
}
2.
Creating a new 'Static' class in django.contrib.staticfiles and
integrating it with the current implementation to add preprocessing.
Another
option is that, we can have a permanent solution without any future
need of any ad-hoc based solution for the problem of static resource
optimisation. But it will require a lot of changes in the entire
structure of staticfiles, mostly in staticfile handlers and storage.
Placement of compiler support files in contib.staticfiles might also be a
concern in this case.
I am still discovering and learning new
things about django and preprocessing. I'd really appreciate if I'll be
able to get feedback on this from django community, so that I can draft a
better proposal for this project.
Thanks
Varun