
from flask import url_for
from npactflask import app


@app.template_global()
def vSTATIC(filename):
    if app.config['DEBUG']:
        return url_for('static', filename=filename)
    else:
        return url_for('static',
                       filename=filename, vnum=app.config['VERSION'])

import os.path

from flask import url_for

from npactflask import app


# TODO: I think this is more simply a template_global:
#  http://flask.pocoo.org/docs/0.10/api/#flask.Flask.template_global
@app.context_processor
def vSTATIC():
    def STATICV(filename):
        if app.config['DEBUG']:
            vnum = os.path.getmtime(os.path.join(app.static_folder, filename))
        else:
            vnum = app.config['VERSION']
        return (url_for('static', filename=filename, vnum=vnum))
    return dict(vSTATIC=STATICV)

--- 
+++ 
@@ -1,18 +1,12 @@
-import os.path
 
 from flask import url_for
-
 from npactflask import app
 
 
-# TODO: I think this is more simply a template_global:
-#  http://flask.pocoo.org/docs/0.10/api/#flask.Flask.template_global
-@app.context_processor
-def vSTATIC():
-    def STATICV(filename):
-        if app.config['DEBUG']:
-            vnum = os.path.getmtime(os.path.join(app.static_folder, filename))
-        else:
-            vnum = app.config['VERSION']
-        return (url_for('static', filename=filename, vnum=vnum))
-    return dict(vSTATIC=STATICV)
+@app.template_global()
+def vSTATIC(filename):
+    if app.config['DEBUG']:
+        return url_for('static', filename=filename)
+    else:
+        return url_for('static',
+                       filename=filename, vnum=app.config['VERSION'])
Disable vSTATIC version during DEBUG

when DEBUG is set we serve static files with max-age of zero which is
hopefully good enough. Adding to the querystring is messing up chrome
development workflow (breakpoints are associated with full uri,
including querystring).
