Flask Snippets

Snippets are unofficial and unmaintained.

This is an archived view of user-submitted snippets. Despite being hosted on the Flask site, they are not official. No Flask maintainer has curated or checked the snippets for security, correctness, or design.

app.before_request handlers for less and coffeescript

Posted by Rahul Kumar on 2012-05-19 @ 11:15 and filed in Decorators


I am using less and coffee in one of my projects. I found Steve Losh's extension which does the less compilation https://github.com/sjl/flask-lesscss/blob/master/flaskext/lesscss.py and I read somewhere there is another based on it for coffeescript.

The extension, though quite simple, does a os.walk for each request irrespective of what the request does.

I am using a slightly modified version which doesn't do an os.walk and handles blueprints.

EDIT: I can't figure out how to paste code.


This snippet by Rahul Kumar can be used freely for anything you like. Consider it public domain.