2

Edit

Solution

I used already compressed pictures. Don't know, why. So the pictures in the subdirectories are compressed, but only if they aren't already.

Goal

Compress and copy all images from within directory "frontend/images" to "public/assets/images".

Problem
The pictures in the subdirectories aren't compressed.

I'm using LaravelMix and passing webpack configs to it like this:

mix.webpackConfig({
    plugins: [
        new CopyWebpackPlugin({
                patterns: [
                    {
                        from: 'frontend/images', to: 'assets/images'
                    }
                ],
            },
        ),
        new ImageminPlugin({
            pngquant: ({quality: [0.5, 0.5]}),
            plugins: [imageminMozjpeg({quality: 50})],
        }),
    ],
});

The subdirectories are copied properly. An image (here "test") in the "images" folder get compressed but images in the subdirecoties not.

So what i'm doing wrong here?

Or isn't is possible to compress the images in the subdirectories and i have to add each folder seperately?

Images folder

leonp5
  • 305
  • 7
  • 23

0 Answers0