minify static files (css and js)

757 views
Skip to first unread message

gert

unread,
Aug 7, 2011, 8:36:16 AM8/7/11
to Django developers
Hi

I have always wanted to minify my css and js but it never seemed like
the right time to do it. Somehow there is always something I know I
want to tweak first so I'll release it as is for now... :)

Having used the django-staticfiles app for some time now I just
realised that that would actually be the perfect place to implement
minify functionality. I think it will make minification a standard for
many sites if css and js files got minified when you run
collectstatic.

Not sure what the implications would be just sharing a thought.

Regards
Gert


Aymeric Augustin

unread,
Aug 7, 2011, 10:03:54 AM8/7/11
to django-d...@googlegroups.com
Hello,

You're probably looking for: https://github.com/jezdez/django_compressor

Best regards,

--
Aymeric Augustin.

> --
> You received this message because you are subscribed to the Google Groups "Django developers" group.
> To post to this group, send email to django-d...@googlegroups.com.
> To unsubscribe from this group, send email to django-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
>

Jonathan Slenders

unread,
Aug 8, 2011, 5:19:04 AM8/8/11
to Django developers
This one is a more powerful compressor, but does not easily work out
of the box on every website:

https://github.com/citylive/django-template-preprocessor

I personally think there are too many ways of minifying content.
Minifying is about making assumptions about what information in the
files you serve can be removed. If you're going to the extreme -- like
minifying classnames of html elements, and replacing the matching
class names in css and javascript files -- you also have to make other
assumptions about how everything is structured.

We shouldn't have this in Django Core or contrib. Any minification
algorithm can easily be implemented with template loaders, middleware
or template filters.



On 7 août, 16:03, Aymeric Augustin

Alexander Schepanovski

unread,
Aug 9, 2011, 1:44:31 AM8/9/11
to Django developers
I prefer webassets. You may also look into.

Silvio

unread,
Aug 10, 2011, 9:07:36 PM8/10/11
to Django developers
I feel inclined to mention the tool I built:
https://www.sgawebsites.com/projects/django-aggregator/ . Very easy to
use, and easy to deploy.

-
Silvio

Jannis Leidel

unread,
Aug 11, 2011, 4:18:09 AM8/11/11
to django-d...@googlegroups.com
On 11.08.2011, at 03:07, Silvio wrote:

> I feel inclined to mention the tool I built:
> https://www.sgawebsites.com/projects/django-aggregator/ . Very easy to
> use, and easy to deploy.


Thanks all for the list of apps, but this isn't really the place for it.

You may be interested in the RFC at
https://groups.google.com/d/topic/django-developers/jlnw-TUwtuk/discussion
though.

Jannis

Warren Smith

unread,
Aug 9, 2011, 9:20:49 AM8/9/11
to django-d...@googlegroups.com
There seems to be quite a few of these sort of things out there. I've been keeping an eye out for a clear winner.

A friend pointed me at http://www.allbuttonspressed.com/projects/django-mediagenerator, and that page links to the following comparison:


I'm not sure how current this information is, but it is very informative nonetheless. They all seem to have their strengths and weaknesses.

I guess the choice depends on which functionality is important to you.

--
Warren Smith

Tony Tong

unread,
Dec 7, 2015, 5:53:20 AM12/7/15
to Django developers (Contributions to Django itself)
I'm a html editor, I always use this free online tool to minify js file and minify css file. after the minification, the static file will be much smaller.

buyi wen

unread,
Dec 11, 2015, 8:45:01 AM12/11/15
to Django developers (Contributions to Django itself)
you can try this free online service to compress javascript  and minify css , so it will reduce the size of web page. only need you upload the static js and css files, then you can download the mini file.

Florian Apolloner

unread,
Dec 11, 2015, 11:49:27 AM12/11/15
to Django developers (Contributions to Django itself)
Please stop spamming this thread with a advertisements for an online service. This is completely useless to us.
Reply all
Reply to author
Forward
0 new messages