Laravel-mix: Document setPublicPath and setResourceRoot

Created on 14 Mar 2019  路  3Comments  路  Source: JeffreyWay/laravel-mix

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.

stale

Most helpful comment

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.

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Micaso picture Micaso  路  3Comments

jpmurray picture jpmurray  路  3Comments

amin101 picture amin101  路  3Comments

sdebacker picture sdebacker  路  3Comments

Bomavi picture Bomavi  路  3Comments