Aleksandrs
Aleksandrs

Reputation: 1509

Laravel Mix - URL Processing works wrong when web site on localhost is not in root folder

Web server structure:

localhost/my_site_folder/public

When I am using url(../images/example.png) in my scss file, mix automatically finds example.png, copy it to my public/images folder, and then rewrites the url() within my generated stylesheet (https://laravel.com/docs/5.6/mix#url-processing)

Cool feature and everything seems fine, except fact, that link was generated as it was described in docs background: url(/images/example.png?d41d8cd98f00b204e9800998ecf8427e);, but in my case this link is to localhost/images/example.png?d41d8cd98f00b204e9800998ecf8427e but I need to localhost/my_site_folder/public/images/example.png?d41d8cd98f00b204e9800998ecf8427e.

And I can't find where I could setup my website root folder path.

P.S. for example, in laravel it could be done via .env file APP_URL=http://localhost/my_site_folder/public

Is there is something similar in mix?

Upvotes: 0

Views: 1494

Answers (2)

Aleksandrs
Aleksandrs

Reputation: 1509

This do the trick mix.setResourceRoot("../"). Thanks to Namoshek comment.

Upvotes: 2

Loctarogar
Loctarogar

Reputation: 620

maybe

php artisan storage:link

will be the answer? https://laravel.com/docs/5.6/filesystem

Upvotes: 0

Related Questions