- Without special templatetags
- Without specifying explicit bundles
- Served dynamically in development
- Compiled by collectstatic for producton
This code is the minimum required for this.
There are two things to take into account:
- list method to find coffeescript files to compile for collectstatic
- find method to find coffeescript equivalent for a js file for django.contrib.staticfiles.views.serve.
The list method will use the list method on all finders that come before it in STATICFILES_FINDERS to find all the files that end with .coffee and will return the equivalent .js path with a storage class that knows how to compile the coffeescript.
The find method will use the find method on all finders that come before it in STATICFILES_FINDERS to locate the coffeescript file that is actually being requested.
It will then compile the coffeescript into a file in settings.CACHE_DIR before serving that file.