How can I integrate CSS/JS/Image preprocessors with django.contrib.staticfiles? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this questionIn Django 1.3, django.contrib.staticfiles
provides a nice "blessed" solution to managing static files, like a site's CSS, Javascript, and images.
However, I don't see an obvious way to integrate arbitrary static file preprocessors (concat/minify CSS/JS, spritesheet autogen a la SmartSprite, etc.) with the staticfiles app.
Do any projects/snippets/solutions exist for this that will integrate well开发者_JAVA技巧 with django.contrib.staticfiles
?
django-compressor have support for this, asking you to add 'compressor.finders.CompressorFinder' to the STATICFILES_FINDERS setting. I guess you can use or spy their code to see what they have done to achieve this.
django-compressor is definitely my preferred option because of how easy it is to just wrap blocks of css and js includes and have them compressed, however it does not do sprite sheets.
So you could either build in an additional processor to django-compressor using spritesticker or use django-media-bundler instead which does both but takes more effort to setup.
精彩评论