How can I change the public path to something containing an underscore in Laravel Mix?
There is an undocumented (I believe) method called setPublicPath
. You can then omit the public path from the output. setPublicPath
plays nicely with underscores.
mix.setPublicPath('public_html/');
mix.js('resources/assets/js/app.js', 'assets/js')
.sass('resources/assets/sass/app.scss', 'assets/css');
In Laravel 5.5 I've solved like this,
mix.setPublicPath('public_html/')
.js('resources/assets/js/app.js', 'front/js')
.js('resources/assets/js/custom.js', 'front/js')
.sass('resources/assets/sass/app.scss', 'front/css')
.styles('resources/assets/css/custom.css', 'public_html/front/css/custom.css');