Django Vue Utilities¶
Django Vue Utilities is a Django template tag collection for use with a Vue integration as described in Cookiecutter Vue + Django
Install¶
$ pip install django-vue-utilities
Add to settings.py
.
INSTALLED_APPS = [
# ...
'django_vue_utilities',
]
Usage¶
{% load vue_utils %}
{% block extra_js %}
{# Import entrypoint JavaScript, choosing dev or static source depending on settings #}
<script type="module" crossorigin src="{% vue_bundle_url 'my_vue_entrypoint' %}"></script>
{# 'provide" strings which can 'injected' throughout the Vue app, including from within a pinia store #}
{% url 'home' as homeUrl %}
{% vue_provide 'homeUrl' homeUrl %}
{% endblock %}