Include dev version of vue.js if available in the HTTP static/js

folder, otherwise include the minified version
This commit is contained in:
Fabio Manganiello 2019-12-01 16:18:33 +01:00
parent abbfe517de
commit 3bbb6cf053
2 changed files with 7 additions and 2 deletions

View file

@ -32,8 +32,12 @@
{% endif %} {% endif %}
</script> </script>
{% if utils.isfile(static_folder, 'js', 'lib', 'vue.js') %}
<script type="text/javascript" src="{{ url_for('static', filename='js/lib/vue.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/lib/vue.js') }}"></script>
{% else %}
<script type="text/javascript" src="{{ url_for('static', filename='js/lib/vue.min.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/lib/vue.min.js') }}"></script>
{% endif %}
<script type="text/javascript" src="{{ url_for('static', filename='js/lib/axios.min.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/lib/axios.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='js/api.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/api.js') }}"></script>

View file

@ -109,7 +109,8 @@ class HttpUtils(object):
return f.read() return f.read()
@classmethod @classmethod
def isfile(cls, file): def isfile(cls, *path):
return os.path.isfile(file) path = path[0] if len(path) == 1 else os.path.join(*path)
return os.path.isfile(path)
# vim:sw=4:ts=4:et: # vim:sw=4:ts=4:et: