5 ms·
What are people using these days for compiling their static assets (js minification + concatenation, etc)? We have been using django-pipeline but it has been a
by TheMakeA 13y ago
What are people using these days for compiling their static assets (js minification + concatenation, etc)? We have been using django-pipeline but it has been a nightmare.
- rule30 13y agoThis is a brilliant question, any package about that?
- papercruncher 13y agoWe switched to the google pagespeed module for nginx and stop worrying about it. It doesn't do minification very well but it does concatenation and takes care of a bunch of other stuff as well, like image resizing, CSS concatenation etc. We used to use the HTML5 Boilerplate script but it was horrendously slow on EC2
- tdj 13y agoI'm pretty happy with django-compressor.
- bigsassy 13y agoMe too.
- conesus 13y agoI use Jammit for static asset compression. (from https://medium.com/cs-math/f29f6080c131 https://medium.com/cs-math/f29f6080c131) Jammit came out of DocumentCloud, and even though it was built for Ruby on Rails you can do something like this and use it for Django pretty easily. One of the things I like about it is you can setup different named configurations for javascript and css for different sections of your site (dashboard, non-authenticated, standard). It supports lots of other stuff too. This is how I use Jammit on NewsBlur: https://github.com/samuelclay/NewsBlur/blob/master/utils/jammit.py https://github.com/samuelclay/NewsBlur/blob/master/utils/jam.... I then compress the assets, upload to S3, and then deploy to my servers. See https://github.com/samuelclay/NewsBlur/blob/master/fabfile.py#L1267-L1284 https://github.com/samuelclay/NewsBlur/blob/master/fabfile.p.... Each app server then downloads from S3. So I can package 2MB of static assets and deploy to to a hundred servers in 10 seconds.
- mixmastamyk 13y agomake (actually a simpler alternative).
- mikewhy 13y agohttp://brunch.io/ http://brunch.io/ I've use it in Django, Flask, Rails and static sites with Chaplin, Backbone and now Angular. Works a charm.
- peter_l_downs 13y agoWe're currently using Django Compressor [0], and it works pretty well. It was slightly annoying to get it to work well with staticfiles [1], as we host all of our content on S3 and serve through cloudfront in production. But, it's nice because now we can do this in our template: <script src="{% static js/mylib.js %}"></script> and with compress like this: {% compress js %} <script src="{% static js/mylib.js %}"></script> {% endcompress %} so that referencing static files is consistent. [0]: https://github.com/jezdez/django_compressor https://github.com/jezdez/django_compressor [1]: https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#module-django.contrib.staticfiles https://docs.djangoproject.com/en/dev/ref/contrib/staticfile...
- michaelmior 13y agoI used to use this, and it is convenient for small sites. But it quickly gets hard to manage. It also makes it extremely difficult to share compiled assets between pages with different templates.
- ludwigvan 13y agoWe use django-assets. http://elsdoerfer.name/docs/django-assets/ http://elsdoerfer.name/docs/django-assets/
- michaelmior 13y ago+1 for django-assets. I've found this to be the best solution so far. I've used it combination with django-storages to compile and push assets to S3.
- Spiritus 13y agoWhy has it been a nightmare? I find it pretty neat. Was using django-compressor earlier but it didn't have support for Python 3.
- fletchowns 13y agoI'm curious what problems he had with django-pipeline as well. I've been using it for a couple months now and it has been fantastic.
- falcolas 13y agoCaveat: Small site, low enough traffic that a few kilobytes per request won't break us. I just enable gzipping and don't worry about minification of my own assets. Sure, it means larger initial downloads (since they're cached), but it's typically in the single digit kilobytes, and simplifies debugging like nothing else.
- msonawane 13y agonginx + pagespeed should be better way of doing it