.vuefiles out of the box.
npm install vue. This will add
Vueas a dependency for your project in your project's
package.jsonand into the
node_modulesdirectory. The following is the
package.jsonyou should use when integrating with Vue.js:
App.jscan look like this:
.vuesyntax which allows you to co-locate your template, styles, and scripts in a single-file component.
mix.vue( "app.js" )Elixir would generate a
includes/js/app.cssfile containing the css for the style blocks used in that entrypoint.
Note: there are some drawbacks with style blocks in Vue components and Elixir. if you are creating multiple entry points with multiple
mix.vuecalls, any style blocks in shared components will be duplicated in each of the css files. Additionally, because Elixir is already extracting other css files, style blocks in Vue components are always extracted. For these reasons, we recommend using other approaches to managing your css with Vue components and Elixir.