miracle2k/webassets — pull request #168 by rassie (2012-07-30 13:13:42+00:00)
Title: Introduce 'prefix' option on the bundle

(a word of warning: this is something I've come up with to solve a problem I've had, there might be a more elegant solution, so don't hesitate to criticize)

A prefix makes it possible to redirect all or some of the static files to do some post-processing on the files. Such post-processing might be using a CSS compiler, linting, reformatting etc.

The idea is to aid development. Currently, webassets merges static files if a CSS/JS compiler is used, even in development, however, unmerged files are best suited for debugging. At the same time, compilation might be needed even in development, e.g. when some of the bundle's contents are LESS files and browser-based less.js is unsuited. Same is probably also true for Django templates.

So now, with debugging option on the bundle, files are returned as is, which is unsuitable for developing with LESS. Without it, files are combined, which is fine for production, but unsuitable for development. With the prefix option and debugging on, pseudo-bundle processing can be done in a custom view and thus be suitable for development with tools like LESS.

An example of such post-processing view for Django can be found at https://gist.github.com/3206764