cyberdelia/django-pipeline — pull request #162 by Xowap (2012-12-04 00:50:31+00:00)
Title: Avoid systematic CSS re-compilation by detecting outdated files

I went tired of Bootstrap's 1s compile time at each page reload, so I modified the compilers a bit in order to compile the file only in the case where one of the source files were modified since last compilation.

This brought a slight change in the compiler's API (a new `is_outdated()` method), a new common ancestor for all CSS compilers (`CssCompiler`), and a new family of file tree classes (based upon `BaseFileTree`).

Initially I thought of doing this only for Less, but actually it was so easy to implement it for Stylus and SASS that I did it. I know that they might have their own cache and stuff, but:

* Being given the Stylus command, I doubt it is able to cache/check anything (it reads/write from stdin/out)
* And anyways, stat-ing a few files is cheaper than starting a new process (especially when the process is some heavy interpreter)

I made some tests I could think of and it worked out fine, however I'm not sure that my way of handling the search path is consistent or makes any sense at all.