Skip to content

Commit

Permalink
fix(website): Bust cache by passing build_version to link and script …
Browse files Browse the repository at this point in the history
…sources
  • Loading branch information
surajshetty3416 committed Nov 9, 2020
1 parent 0131288 commit 13175a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions frappe/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
{%- if theme.name != 'Standard' -%}
<link type="text/css" rel="stylesheet" href="{{ theme.theme_url }}">
{%- else -%}
<link type="text/css" rel="stylesheet" href="/assets/css/frappe-web-b4.css">
<link type="text/css" rel="stylesheet" href="/assets/css/frappe-web-b4.css?ver={{ build_version }}">
{%- endif -%}

{%- for link in web_include_css %}
<link type="text/css" rel="stylesheet" href="{{ link|abs_url }}">
<link type="text/css" rel="stylesheet" href="{{ link|abs_url }}?ver={{ build_version }}">
{%- endfor -%}
{%- endblock -%}

Expand Down Expand Up @@ -94,12 +94,12 @@
{% block base_scripts %}
<!-- js should be loaded in body! -->
<script type="text/javascript" src="/assets/frappe/js/lib/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/assets/js/frappe-web.min.js"></script>
<script type="text/javascript" src="/assets/js/frappe-web.min.js?ver={{ build_version }}"></script>
<script type="text/javascript" src="/assets/js/bootstrap-4-web.min.js"></script>
{% endblock %}

{%- for link in web_include_js %}
<script type="text/javascript" src="{{ link | abs_url }}"></script>
<script type="text/javascript" src="{{ link | abs_url }}?ver={{ build_version }}"></script>
{%- endfor -%}

{%- block script %}
Expand Down
2 changes: 1 addition & 1 deletion frappe/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,4 +728,4 @@ def get_build_version():
except OSError:
# .build can sometimes not exist
# this is not a major problem so send fallback
return frappe.utils.random_string(8)
return frappe.utils.random_string(8)
3 changes: 1 addition & 2 deletions frappe/website/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,7 @@ def get_page_info(path, app, start, basepath=None, app_path=None, fname=None):
# extract properties from controller attributes
load_properties_from_controller(page_info)

# if not page_info.title:
# print('no-title-for', page_info.route)
page_info.build_version = frappe.utils.get_build_version()

return page_info

Expand Down

0 comments on commit 13175a8

Please sign in to comment.