Make sure to always return the same cache busting string on prod, so that reloads of the page can still use the same cached resources

This commit is contained in:
Joseph Schorr 2014-07-29 20:54:16 -04:00
parent af32b53a4e
commit b12d63ce9a

View file

@ -138,6 +138,8 @@ def list_files(path, extension):
filepath = 'static/' + path
return [join_path(dp, f) for dp, dn, files in os.walk(filepath) for f in files if matches(f)]
SAVED_CACHE_STRING = random_string()
def render_page_template(name, **kwargs):
if app.config.get('DEBUGGING', False):
# If DEBUGGING is enabled, then we load the full set of individual JS and CSS files
@ -156,7 +158,7 @@ def render_page_template(name, **kwargs):
main_styles = ['dist/quay-frontend.css']
library_scripts = []
main_scripts = ['dist/quay-frontend.min.js']
cache_buster = random_string()
cache_buster = SAVED_CACHE_STRING
external_styles = get_external_css(local=not app.config.get('USE_CDN', True))
external_scripts = get_external_javascript(local=not app.config.get('USE_CDN', True))