Flask-Assets not working at all... = Insanity
Question: I have simply tried setting up _[flask-assets](http://flask-
assets.readthedocs.org/en/latest/)_ (based on _webassets_), however just can't
get it to work.

I have the standard setup;

  * python virtualenv
  * pip to install the bare essentials (flask, flask-assets)
  * sass ruby gem (for trying sass / scss)
  * less via npm (for trying lesscss)
  * jsmin via pip (for trying jsmin)

Config:

  * I have created a working homepage in Flask
  * `static` folder created (for css / js assets)
  * The css / js files are confirmed working (css background, js slider, etc)
  * Basically my development non-flask-assets site is working perfectly

I have followed the easy official guide here: [flask-assets
usage](http://flask-assets.readthedocs.org/en/latest/). I fully understand how
to work with it (as per that page). I have even exact copy-pasted the code, &
still can't get it working.

Some code I've tried (for lesscss): (of course I have working css in
main.less)

    
    
    from flask.ext.assets import Environment, Bundle
    assets = Environment(app)
    assets.debug = True
    
    lesscss = Bundle('main.less', output='main.css', filters='less')
    assets.register('less', lesscss)
    

Then in my template:

    
    
    {% assets "less" %}
    <link href="{{ ASSET_URL }}" rel="stylesheet">
    {% endassets %}
    

However flask-assets just won't work. I've tried the same with sass, scss, &
also jsmin (exact code copy-paste from the usage guide) - it still won't work.

  * I notice that the `.webassets-cache` folder is created, but is (always) empty...

Also; relevant error?; I expect it to create the main.css, but as it doesn't,
I get an error in the browser (using `app.debug = True` & flask's built-in dev
server):

    
    
    webassets.exceptions.BuildError
    BuildError: Nothing to build for <Bundle output=css/main.css, filters=[<webassets.filter.less.Less object at 0x7f4958dc6710>], contents=('css/main.less',)>, is empty
    

So; If I manually create an empty main.css, it loads the page (no error),
_however_ the main.css file is not filled with css so _flask-assets_ /
_webassets_ in still not working.

I've also tried passing the _assets_ object to the template in various ways
just in case it's needed (although no documentation states this) - that didn't
work.

It's been driving me crazy. Any pointers would be appreciated.  
Thank you


Answer: There is info missing on the Flask-Assets docs. You problem is either the
sass_bin config or the enviroment load path. You should try both, in my case
it was the config. See below my working config.

PS: IMHO Flask Assets is neither very complete nor well documented. It also
consumes you application runtime, which sucks both on debugging and
production. I have switched to GULP!

    
    
     env = Environment(app)
     env.config['sass_bin'] = '/usr/local/bin/sass'
     # env.load_path = [os.path.join(os.path.dirname(__file__), 'sass')]
     js = Bundle('js/jquery/jquery-2.1.4.js', 'js/angular/angular.js',
                 'js/socketio/socket.io.js', filters='jsmin', output='js/all_min.js')
     env.register('js_all', js)
     myjs = Bundle('myjs/Interpolation.js', 'myjs/socketio.js' , filters='jsmin', output='myjs/all_min.js')
     env.register('myjs_all', myjs)
     css = Bundle('sass/base.sass', filters='sass', output='css/base.css')
     env.register('css_all', css)
    

