CSS Preprocessor
Here is a Django view that turns code like this: @variables { $varcolor: #333; } body { color: $varcolor; padding: 20px; } .space { padding: 10px; } .small { font-size: 10px; } #banana(.space, .small) { margin-bottom: 10px; } And turns it into something like this: body { color: #333; padding: 20px; } #banana { padding: 10px; font-size: 10px; margin-bottom: 10px; } .small { font-size: 10px; } .space { padding: 10px; } Notice the variables declaration at the top. The other feature is *extending* - here #banana extends .space and .small. The url.py entry might look something like this: (r'^css/(?P<css>(\w|-)+)\.css$','csspp.csspp'), Here referencing csspp.py in your path (root directory of your site probably). The code also looks for a CSS_DIR setting in your settings file. You will probably want to point straight to your media/css/ directory. **Known problems** * There is now way of extending selectors that are already extending something else. In the example code there is now way to extend #banana since it is already extending .small and .space.
- css
- preprocessor
- csspp