In debug mode, use the app's static dir first

In debug mode, files should always be compressed based on the app's static directory, not the global static directory, where files can be outdated.

This is related to #425, I found out about this bug after having written this commit. However, my commit includes a unit test (which was much more work than the actual change in the code), so I don't consider my efforts wasted ;-)