Install vue.js via npm and use it

Published 2 years ago by bart

Hey guys,

can you give me a quick hint how I can use vue, added by the npm install command? Do I need elixir for this? Or do I only nee to require vue from inside my app?

Thanks!

Best Answer (As Selected By bart)
_stefanzweifel

I just installed Vue in a new project.

I created a new file resources/assets/js/app.js and in there I require Vue like so:

var Vue = require('vue');

In my gulpfile.js I added this mix:

mix.browserify('app.js');

Browserify will then search the Vue.js source on it's own and inject it in the final file.

Jeffrey also made a video for that: https://laracasts.com/series/learning-vuejs/episodes/9

_stefanzweifel

I just installed Vue in a new project.

I created a new file resources/assets/js/app.js and in there I require Vue like so:

var Vue = require('vue');

In my gulpfile.js I added this mix:

mix.browserify('app.js');

Browserify will then search the Vue.js source on it's own and inject it in the final file.

Jeffrey also made a video for that: https://laracasts.com/series/learning-vuejs/episodes/9

bart
bart
2 years ago (60,870 XP)

Thanks @_stefanzweifel! I got confused with bower. Browserify, NPM, Composer, Bower - too much stuff.

_stefanzweifel

@bart Indeed. It get's more confusing every day :(

Please sign in or create an account to participate in this conversation.