All Lessons / How to use Vue.js and Turbolinks together

How to use Vue.js and Turbolinks together

#182 ยท April 17, 2017

Your Teacher | Chris Oliver

Hi, I'm Chris. I'm the creator of GoRails, Hatchbox.io and Jumpstart. I spend my time creating tutorials and tools to help Ruby on Rails developers build apps better and faster.

About This Episode

Using Vue.js and Turbolinks together can be a little complex to wrap your head around at first. We not only dive into how this works but we take a look at the vue-turbolinks node module I made so that you can easily use the two together.

Notes

Resources

To add Vue-Turbolinks into your Rails Webpacker installation, you can do the following:

yarn add vue-turbolinks
import TurbolinksAdapter from 'vue-turbolinks';

document.addEventListener('turbolinks:load', () => {
  var vueapp = new Vue({
    el: "#app",
    template: '<App/>',
    mixins: [TurbolinksAdapter],
    components: { App }
  });
});

Discussion

Loading...
logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.