Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining and Compressing multiple JavaScript files into a single file in a Django project

What is the simplest way to combine JavaScript files into a single file in a Django project?

Explanation

I want this to work with Ember.js/Backbone where you (usually) have many different JavaScript in multiple directories. Directories would all be in one folder called app/ for example, like: app/views/ app/models/ /app/routers/

Requirements

  • Work together with the staticfiles app
  • Still be separated while in development mode for easier debugging (only compile when calling collectstatic?)
  • Work with Require.js (guess that shouldn't be too hard, but putting it in here to be sure)

Extra credit

Explain a best practices way of combining Django and Ember/Backbone.

like image 833
c4urself Avatar asked Dec 15 '11 19:12

c4urself


1 Answers

I am an happy user of django compressor, it does combine, minify, debug-friendly, you can use it with staticfiles, easy to plug with custom storage backend (eg. S3)

https://github.com/jezdez/django_compressor

like image 87
Tommaso Barbugli Avatar answered Oct 04 '22 20:10

Tommaso Barbugli