How can I define a root component with Vue, that wraps my entire code, so all other components are descendants from that root?
Basically I would like to achieve something like:
In application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<%= csrf_meta_tags %>
<%= stylesheet_pack_tag 'application' %>
</head>
<body>
<div id="root">
<%= yield %>
</div>
<%= javascript_pack_tag 'application' %>
</body>
</html>
and then on my webpack entry point
...
import Vue from 'vue';
var app = new Vue({
el: '#root'
})
However, when I do this I got a Vue warning that says:
[Vue warn]: You are using the runtime-only build of Vue where the template option is not available. Either pre-compile the templates into render functions, or use the compiler-included build.
So, from what I understood, this happens because I need to put my vue components inside .vue files but then, if I do that, how can I still use the yield statement to implement the rest of the views the "rails way"?
In the end, I guess, it all resumes to how can I organize my frontend using vuejs, webapack only(no asset pipeline) in rails and but still use some of the rails features like yield to render the "normal" views?
P.S: I already saw the hello world example that comes when you start a new project with webpack, but it's to simple...
vue: 'vue/dist/vue.js'to your webpack aliases.yieldwhich would be your vue's root. But either way, I'm not sure of what you're wanting to achieve here. If you just want to use some vue components, mount them whenever/where you need them?