1. Edit webpack.config.js after
    Encore
    .setOutputPath(‘../build/’)

Encore
    // directory where compiled assets will be stored


    .enableVersioning()
    .copyFiles({
     from: './assets/images',

     // optional target path, relative to the output dir
     to: 'images/[path][name].[ext]',

     // if versioning is enabled, add the file hash too
     //to: 'images/[path][name].[hash:8].[ext]',

     // only copy files matching this pattern
     //pattern: /\.(png|jpg|jpeg)$/
    })

2. Get the image like

<img src="{{asset('build/images/logo.svg')}}" title="" alt="">

More details : https://symfony.com/doc/current/frontend/encore/copy-files.html

By toihid

Leave a Reply