Home > front end >  How to use mix function in laravel
How to use mix function in laravel

Time:10-31

I'm writing a program using laravel. To manage css and js, I used versioning and call it with a function like this
<link rel="stylesheet" href="{{ mix('/css/app.css') }}">
The code above produces html output as follows
<link rel="stylesheet" href="/css/app.css?id=53a226b301fc510ddf79">

When I upload to hosting, why does the above code only produce html like this ?
<link rel="stylesheet" href="/css/app.css"> (the mix-manifest.json / id file not load)

this is my localhost https://drive.google.com/file/d/1cALnZ6qE1542bwbc-m02O6LHBOAQxGxe/view?usp=sharing

and this is on the hosting https://drive.google.com/file/d/1OInaSCx6Kvcb1B_2E2O7DHC7kjjbMfO4/view?usp=sharing

CodePudding user response:

I think in your localhost your laravel run in development mode. And in the hosting the laravel run with production mode. Check your .env file.

CodePudding user response:

Did you run npm run dev after deploy it on your hosting? Make sure in your webpack.mix.js have .version() method.

  • Related