0

A minor question. I was trying to learn routing using Vue.JS in laravel, so I went to this website and I see :

<script src="{{ mix('js/app.js') }}"></script>

And this differs from what I know on including app.js into my website like this:

<script src="{{ asset('js/app.js') }}"></script>

My question is:

  1. Is there any difference on using one of them?
  2. When to use mix or asset?
  3. Does using asset affect routing in Vue.JS?

I tried using either of them, but as I said, I'm new to routing using laravel & Vue.JS so I don't know where I did wrong. I can't get it to work.

I've also tried googling, but what they show isn't related to my question,

.

.

PS: Additional Notes.

  1. In my "website" I already implemented Authentication. Could be a factor or not that cause my routing to fail. If so, how to handle this?
Zombie Chibi XD
  • 370
  • 3
  • 17
  • 1
    Possible duplicate of [Laravel asset vs mix](https://stackoverflow.com/questions/50926914/laravel-asset-vs-mix) – Zombie Chibi XD Jan 07 '19 at 07:33
  • This question has already been answered [here](https://stackoverflow.com/questions/50926914/laravel-asset-vs-mix), and for more information about mix please visit this [link](https://laravel.com/docs/5.7/mix) – George J Jan 07 '19 at 07:27

1 Answers1

1

The mix() function will bring you the versioned file of that asset(with a unique id) While the asset function will not take into affect changes made to that asset while running npm run dev or npm run watch The mix function is for cache busting.

GabMic
  • 1,422
  • 1
  • 20
  • 37