Question

I use RequireJS for managing dependencies between my JavaScript libraries and modules. The backend is written in Django. Django has many apps for managing static assets, but none of them talk about incorporating the r.js compiler.

What's the best way to manage and compile my JS files using r.js in Django?

My requirements are:

  1. Versioned output file to get around caching when the file is updated.
  2. Automatically use uncompiled JS file when DEBUG = True in settings.py for Django, and the compiled file when Debug = False.
  3. Some of the libraries will be loaded from CDN (such jquery) with a local fallback.

Any suggestions will be much appreciated.

Was it helpful?

Solution

Seems as though django-require covers at least some of what you need, https://github.com/etianen/django-require .

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top