I was trying to get a slightly unusual file output setup working, and I didn't fully understand these two methods. In the official docs, setPublicPath is only mentioned twice, both times in examples without a thorough explanation of what it does, and setResourceRoot isn't mentioned at all.
It took me an hour of trial and error before I understood those functions (and their effects on CSS and other mix methods) well enough to configure my project correctly. It would be nice to have an official explanation in an easily-findable place in the official documentation.
I found this link in Google because I was struggling to work out the differences between setPublicPath and setResourcePath. Please document these.
For anyone else:
setPublicPath sets the base output path for any mix assets. Fonts, images etc.
setResourcePath sets the base output path in the generated assets relative to the public root (e.g. url('/css/fonts/font.tty'));
mix.setPublicPath('public_html/css');
mix.setResourceRoot('/css');
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
setResourcePath OR setResourceRoot are not mentioned anywhere on laravel-mix.com
setPublicPath is mentioned once in the FAQ but does not mention css, html or js appearing in root or wrong folder. setPublicPath is also mentioned under Installation but I found on Windows that I also needed mix.setResourceRoot and set to the same location or child folder of setPublicPath.
I think these would be very valuable if they were better explained and added to the docs.
Most helpful comment
setResourcePathORsetResourceRootare not mentioned anywhere on laravel-mix.comsetPublicPathis mentioned once in the FAQ but does not mention css, html or js appearing in root or wrong folder.setPublicPathis also mentioned under Installation but I found on Windows that I also neededmix.setResourceRootand set to the same location or child folder ofsetPublicPath.I think these would be very valuable if they were better explained and added to the docs.