I have a generic template, used for including html (ie. a menubar in menubar.html
) into other app templates, through the include
tag. It has some defined css and js functionality, stored in respective menubar.css
|menubar.js
files.
Is seems much more convenient to contain links to these files within the menubar.html
file, as shown below:
//At the Start
<link rel="stylesheet" href="{% static '<appname>/css/menubar.css' %}" />
//.... other menubar HTML
//At the End
<script src="{% static '<app_name>/js/menubar.js' %}"></script>
I'm worried this isn't good practise, because the template will be loaded with the css not located in HEAD
and js not located at the end of BODY
.
These are described as the standard HTML practises.
The clear alternative is to link the css or js in every template that I include the subtemplate, but this seems tedious.
I know there is also the possibility of extending a template, however I believe the same issues occur with css/js usage.
What's best?