开发者

How can I integrate CSS/JS/Image preprocessors with django.contrib.staticfiles? [closed]

开发者 https://www.devze.com 2023-03-14 03:09 出处:网络
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines guidelines. It is not currently accepting answers.
Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines guidelines. It is not currently accepting answers.

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 question

In 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号