Answer the question
In order to leave comments, you need to log in
How to optimize RequireJS modules in Django project?
Good afternoon!
The problem is this.
There is a Django project whose js modules are written using RequireJS.
Two js scripts are connected to the main page of the project:
<script data-main="{% static "js/main" %}" src="{% static "js/require.js" %}"></script>
<script src="{% static "js/config.js" %}"></script>
#tempate.html
{% block content %}
.....
.....
<script>require(['module_carousel']);</script>
{% endblock %}
Answer the question
In order to leave comments, you need to log in
logos7 : there is no ideal
Once again - you need to understand what your problem is and whether it exists at all
Two extremes
1) decompose everything into modules and load as pages open
2) put everything into one file and load it at the first start
And it all depends on your audience and its behavior
About compression
If you already have uglify js or something like that installed and compression is enabled on the server by 9, then you have already done 20% of the work, which gave 80% performance
Further, nothing will depend on janga at all (unless REST API) - frontend things will work further
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question