osxtra's avatar

Getting .copy to honor .setPublicPath

So far as Lavarel is concerned, I'm using a non-standard public folder, and employ mix.copy for locally hosted fonts.

Folder structure:

www/ (project root)

www/laravel/ (laravel root)

www/public_html/ (document root)

www/public_html/fonts/ (local fonts)

www/public_html/css/ (style sheets)

www/public_html/js/ (javascript)

mix.copy seems to ignore setPublicPath, though .js and .sass work as expected.

If webpack.mix.js contains:

.setPublicPath('../public_html')

.copy('resources/assets/fonts/.', 'fonts')

.js('resources/assets/js/app.js', 'js/app.js')

.sass('resources/assets/sass/app.scss', 'css/app.css')

The font files actually end up in www/laravel/app/fonts/ (it creates the 'fonts' folder on demand), though the css & js files end up where they're supposed to (in their respective folders within public_html, where I also want the fonts to live).

However, specifying a relative destination folder for mix.copy does seem to work:

.setPublicPath('../public_html')

.copy('resources/assets/fonts/.', '../public_html/fonts')

.js('resources/assets/js/app.js', 'js/app.js')

.sass('resources/assets/sass/app.scss', 'css/app.css')

Have also messed with mix.copyDirectory, but that produces the same results.

This behavior is the same for other media as well (images, etc.).

So, when using mix, how does one make .copy honor .setPublicPath ?

Thanks!

0 likes
0 replies

Please or to participate in this conversation.