New: Learn Statamic on Laracasts!

We've retired the forum in favor of GitHub Discussions.

New conversations can be started on GitHub. Existing conversations will remain for a while longer.

Head over to GitHub →

Using vue js via NPM in Statamic 3 templates

Max Glass February 21, 2021 by Max Glass

Hey fellows,

I wanna use vue js in, let's say, a partial (or in a view, whatever) without using a CDN but with npm. I tested out a bit but nothing worked. Example nav.antlers.html (not working):

I had to remove the script tag because syntax highlighting didn't work for this tag

<nav id="main-nav">
  @{{ msg }}
  <!-- Naughty nav stuff -->

<!-- opening script tag -->
import Vue from 'vue'

const MainNavigation = {
  data() {
    return {
      msg: "hello"

<!-- closing script tag -->

What's the correct approach to use vue in the template without fetching it via a CDN?

Answered by Max Glass!
>>>>>>> Answered <<<<<<<
4 Replies