JoanV's avatar
Level 1

URL processing in public root folder.

Hello!

I have the next trouble in my new laravel 5.4 project. ( I just come from elixir )

.slider-handle{ background: url('../images/slider-button.png'); }

My assets folder structure:

  • fonts
  • images
  • js
  • sass
    • _style.scss
    • app.scss

My images are being published in the public root folder and I would like to publish them in public/images

I just tried to do the next:

mix.webpackConfig({ module: { rules: [ { test: /.(png|jpg|gif)$/, loader: 'file-loader', options: { name: 'images/[name].[ext]?[hash]' } }, ] } });

It's supposed to override the default mix config rule but is not doing it. Is just applying the loader but the default too. Maybe I am ignoring something.

I don't want to edit the node_modules/laravel-mix/setup/ webpack.config.js . I am pretty sure you all know that is not a real option.

0 likes
2 replies
ejdelmonico's avatar
Level 53

Use version ^8.7 because a lot of issues are fixed. And, if you want to overide a rule, it must match or not exist. If you read the Mix code, it will show you the way.

1 like

Please or to participate in this conversation.