Asset path not setting correct compiled path in public folder

Hello,
We use <img src="@asset('images/logo_de_CH.svg')"> in the template to load an image.
After running yarn build the asset is placed where it should be in public/logo-de_CH.fea028.svg

But when the template renders, the path is pointing to https://domain.com/app/themes/my-theme/public/assets/images/logo_de_CH.svg

The wrong asset folder I was able to overcome by changing the code in the template to <img src="@asset('../images/logo_de_CH.svg')">

But now I’m still missing the ‘fea028’ in the compiled asset.

How can I get the correct asset path?

An addition.

This return the correct path.

<?php $asset = \Roots\asset('images/logo-de_CH.svg'); ?>
<img src="<?php echo $asset->uri(); ?>">

But why is <img src="@asset('images/logo_de_CH.svg')"> not working?

:thinking: But internally that directive calls the same function \Roots\asset(...):

What version of acorn are you using in the theme?

I updated to Acorn 4.
This solved the issue.

1 Like