How can I change the public path to something containing an underscore in Laravel Mix? How can I change the public path to something containing an underscore in Laravel Mix? laravel laravel

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');


In Laravel 5.8

mix.config.publicPath='public_html';mix.js('resources/assets/js/app.js', 'public_html/js')   .sass('resources/assets/sass/app.scss', 'public_html'/css');