Have a look first at Flask-Assets and then dive in to Webassets. FYI, Flask-Assets if you set it up as your dependency will include Webassets also. I love Flask because it's simple, to the point and very flexible to extend to your liking.
First of all, Webassets provides a number of transcompiled language support and also minification using filters. Here are some the filters that I'm using routinely:
- cssmin - self explanatory
- less - Less markups to CSS
Webassets is painless to set up and even easier to implement. The first thing you do is to set up a
Bundle like so:
To put the compiled and minified assets into HTMLs, here's a rough example of the HTML template:
So it's trivially easier best of all, you don't have to set up any watchers. Just run the app like any Flask app and it will watch for changes automagically. My best advice is to put the static directory on a memory drive like
/dev/shm if you're using Linux.
Take a look at Flask-Assets FAQ here and smile more everyday :D