Level 28
I do not know much about Mix since I started using it a couple of weeks ago, but I would personally try the following:
- Create a custom console command (php artisan) that would upload compiled files to the desired server
- Add it to your npm run dev / npm run watch commands in your package.json file (perhaps your command would have a param to indicate the destination site - dev or prod)
"scripts": {
// "uploadToServer" would be the command name you choose of course
"dev": "npm run development && php artisan uploadToServer dev",
// other npm commands
"prod": "npm run production && php artisan uploadToServer prod",
// other npm commands
},
- Call "npm run dev" or "npm run prod" as usual, but now it will execute the command you created afterwards
Is it the best way to accomplish what you're trying to do ? I couldn't answer due to my limited Mix knowledge. Would it work ? There are pretty good chances that it would.