Skip to main content

Using jingo and django_compressor but miss offline compression?

Project description

(c) Peter Bengtsson, <mail@peterbe.com>, 2012 License: MIT

For elitists (e.g. me) who use [jingo](https://github.com/jbalogh/jingo) to connect jinja2 with Django a major drawback is that you can’t do offline compression if you use [django_compressor](https://github.com/jezdez/django_compressor).

The compress command that comes with django_compressor only works for regular Django templates. :( Note though, that you can happily use jingo with django_compressor but it only works its magic during runtime. This package aims to solve that with a new command called compress_jingo.

To install

First install it by:

` pip install django-jingo-offline-compressor `

To start with, this assumes that you have django_compressor and jingo set up and working.

Add jingo_offline_compressor to your INSTALLED_APPS.

To run

Just like you’d run regular django_compressor you now run:

` ./manage.py compress_jingo `

And remember, unless you have COMPRESS_OFFLINE = True in your settings you might have to do:

` ./manage.py compress_jingo --force `

That should now have created all the minified and concatenated files in your STATIC_ROOT in a sub-directory called CACHE.

Note: If you have other apps in INSTALLED_APPS that have been added to JINGO_EXCLUDE_APPS some of their templates might actually be included in warnings when you run compress_jingo. Just ignore at will.

What’s next

It’s early days but hopefully if this stabilize and prove its existence. Hopefully it can lead to a decent refactor and to have tests so it can be patched upstream to django_compressor. Hint hint @jezdez, keep an eye on me :)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-jingo-offline-compressor-0.0.4.tar.gz (12.4 kB view details)

Uploaded Source

File details

Details for the file django-jingo-offline-compressor-0.0.4.tar.gz.

File metadata

File hashes

Hashes for django-jingo-offline-compressor-0.0.4.tar.gz
Algorithm Hash digest
SHA256 46b2c3d0f874ddc49abb7e98a652e64f86cc582796308d456df1cd808381c687
MD5 f1523f50bebc16d6ed82f3f46914f9a4
BLAKE2b-256 b56ff9bdef738d7ea663d821413b5b071a06439a81b64318d5af24b6471406f2

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page