Skip to content Skip to sidebar Skip to footer

Vue.js With Django-webpack-loader

I want to use vue.js with Django but get stuck how to integrate vue in the Django templates. I manage to make a bundle with webpack, setup vue with a piece of html which I can open

Solution 1:

I noticed that the vue.js reference needs somehow to come after the vue html tags. Same applies when using Django-web-loader, so {% render_bundle 'main' %} needs to go down. This got it working:

{% load staticfiles %}
{% load render_bundle from webpack_loader %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Webpack Sample Project</title>

</head>

<body>

<h3>[[ message ]]</h3>
kiekeboe

{% render_bundle 'main' %}

</body>
</html>

Post a Comment for "Vue.js With Django-webpack-loader"