Skip to content
Discussion options

You must be logged in to vote

You do not need to put Dropzone on every page unless many pages use upload forms.

The simple rule is:

  • If only one or two pages use uploads, include Dropzone CSS/JS only in those templates.
  • If many pages use uploads, include the CSS/JS in your base layout, but initialize Dropzone only on pages that actually have an upload form.

In Flask/Jinja, a common pattern is to have optional blocks in base.html:

<!-- base.html -->
<head>
  {% block styles %}{% endblock %}
</head>
<body>
  {% block content %}{% endblock %}
  {% block scripts %}{% endblock %}
</body>

Then on the upload page:

{% block styles %}
<link rel="stylesheet" href="https://unpkg.com/dropzone@6/dist/dropzone.css">
{% endblock %}…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RanaUniverse
Comment options

Answer selected by RanaUniverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants