js and css files in my www/«page» are not loading on the webpage. html and py index files are working fine. Took care of disabled_website_cache, no_cache, reloaded nginx, restarted supervisor, build the app multiple times, ran clear-cache, restarted the VM, and even update —reset. None of them worked.
(btw… this is running under production setup)
I’m using Frappe v14. Is there any extra config I need to do for v14?
check the build file version and load version in browser and server.
Can you share the code, with which files in it
This is code that works in Frappe v13. But not in v14.
What is working:
- Only, the HTML files within the www directory are rendered. Ex: www/some.html
What is not working(I see blank page):
- .js and .css files are missing in all cases.
- .HTML, .js, .css files inside subdirectory of www folder are not rendered
I had to include:
{% extends "templates/web.html" %}
{% block script %}
<script src="user-profile/index.js"></script>
{% endblock %}
for the .html to work. I still have an issue with .js
files.
Running into an error => Uncaught ReferenceError: frappe is not defined
Trying to fix it.
any update?
1 Like
nope.
in your html, you should include scripts like they do it in the base template:
or create custom base template and extend it from all pages.
{%- block script %}
{% if colocated_js -%}
<script>{{ colocated_js }}</script>
{%- endif %}
{%- endblock %}
{% block base_scripts %}
<!-- js should be loaded in body! -->
<script>
frappe.boot = {{ boot }}
// for backward compatibility of some libs
frappe.sys_defaults = frappe.boot.sysdefaults;
</script>
{{ include_script('frappe-web.bundle.js') }}
{% endblock %}
{%- for link in web_include_js %}
{{ include_script(link) }}
{%- endfor -%}
<!-- csrf_token -->
{%- block body_include %}{{ body_include or "" }}{% endblock -%}
1 Like