Laravel-mix: Mix-manifest always prefixed with public

Created on 31 Jan 2017  路  6Comments  路  Source: JeffreyWay/laravel-mix

I am running this in a custom project outside of Laravel. I have tried multiple things but the manifest always creates paths with public prefixed:

{
  "public/js/app.js": "public/js/app.ee0ab4b45edac1e84a9d.js",
  "public/css/app.css": "public/css/app.e937875be4a33e00472a.css"
}

My mix file:

mix.js('resources/assets/js/app.js', 'public/js')
  .sass('resources/assets/sass/app.scss', 'public/css')
  .version();

In Laravel the mixfile looks exactly the same yet produces a mix-manifest without the public prefix. I have also looked at the mix() helper in Laravel what am I missing here?

Most helpful comment

For a stand-alone project, you need to tell Mix what your public base directory is. Do:

mix.js('resources/assets/js/app.js', 'public/js')
  .sass('resources/assets/sass/app.scss', 'public/css')
  .version()
  .setPublicPath('public');

All 6 comments

For a stand-alone project, you need to tell Mix what your public base directory is. Do:

mix.js('resources/assets/js/app.js', 'public/js')
  .sass('resources/assets/sass/app.scss', 'public/css')
  .version()
  .setPublicPath('public');

Is there still a way to specificy a custom output for the mix-manifest file though? Because If I change the publicPath the manifest file will be moved there as well.

The mix-manifest.json file should always be in your public directory.

How laravel-mix differentiate whether the project is standalone or laravel project?
Just wondering.
I have a laravel package that use laravel-mix, and confusing why the manifest.json not on public dir.
and i'm landing on this isssue page. and yes problem solved.

Mix will check if you're using a Laravel project, and will automatically set the public path for you. For a standalone-app, we have no idea how you've structured things, so you have to explicitly set it.

https://github.com/JeffreyWay/laravel-mix/blob/master/src/index.js#L37-L39

Ah, , , so checking the artisan file.
Thank you, , ,
Nice!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amin101 picture amin101  路  3Comments

nezaboravi picture nezaboravi  路  3Comments

Bomavi picture Bomavi  路  3Comments

Micaso picture Micaso  路  3Comments

jpmurray picture jpmurray  路  3Comments