Enable DEBUGGING mode, which loads the individual script files rather than the minimized bundles created by grunt
This commit is contained in:
parent
9e4a8097af
commit
ede8ed21f4
4 changed files with 28 additions and 9 deletions
|
@ -115,14 +115,34 @@ def random_string():
|
|||
random = SystemRandom()
|
||||
return ''.join([random.choice(string.ascii_uppercase + string.digits) for _ in range(8)])
|
||||
|
||||
def list_files(path, extension):
|
||||
import os
|
||||
def matches(f):
|
||||
return os.path.splitext(f)[1] == '.' + extension
|
||||
|
||||
def join_path(dp, f):
|
||||
# Remove the static/ prefix. It is added in the template.
|
||||
return os.path.join(dp, f)[len('static/'):]
|
||||
|
||||
filepath = 'static/' + path
|
||||
return [join_path(dp, f) for dp, dn, files in os.walk(filepath) for f in files if matches(f)]
|
||||
|
||||
def render_page_template(name, **kwargs):
|
||||
library_styles = []
|
||||
main_styles = ['dist/quay-frontend.css']
|
||||
if app.config.get('DEBUGGING', False):
|
||||
# If DEBUGGING is enabled, then we load the full set of individual JS and CSS files
|
||||
# from the file system.
|
||||
library_styles = list_files('lib', 'css')
|
||||
main_styles = list_files('css', 'css')
|
||||
library_scripts = list_files('lib', 'js')
|
||||
main_scripts = list_files('js', 'js')
|
||||
cache_buster = 'debugging'
|
||||
else:
|
||||
library_styles = []
|
||||
main_styles = ['dist/quay-frontend.css']
|
||||
library_scripts = []
|
||||
main_scripts = ['dist/quay-frontend.min.js']
|
||||
cache_buster = random_string()
|
||||
|
||||
library_scripts = []
|
||||
main_scripts = ['dist/quay-frontend.min.js']
|
||||
|
||||
cache_buster = random_string()
|
||||
|
||||
resp = make_response(render_template(name, route_data=json.dumps(get_route_data()),
|
||||
main_styles=main_styles,
|
||||
|
|
|
@ -25,8 +25,7 @@ module.exports = function(grunt) {
|
|||
},
|
||||
},
|
||||
build: {
|
||||
src: ['../static/lib/**/*.js', '../static/js/*.js', '!../static/lib/jquery.overscroll.min.js',
|
||||
'../static/dist/template-cache.js'],
|
||||
src: ['../static/lib/**/*.js', '../static/js/*.js', '../static/dist/template-cache.js'],
|
||||
dest: '../static/dist/<%= pkg.name %>.js'
|
||||
}
|
||||
},
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
{% block body_content %}
|
||||
<!-- Note: Must be in the <body> tag -->
|
||||
<script src="static/lib/jquery.overscroll.min.js"></script>
|
||||
<script src="static/standalonelib/jquery.overscroll.min.js"></script>
|
||||
|
||||
<div ng-view></div>
|
||||
|
||||
|
|
Reference in a new issue