Npm run build:production renames images - Displaying Image in Theme File

How can I display an image in the theme files? The problem with using something like:

<img src="<?= get_template_directory_uri(); ?>/assets/images/logo.png" />

Is that logo.png gets renamed during the build process with a random number attached, meaning it 404s

Any suggestions? I’d have expected some sort of helper function if this was the case but I can’t see one


I’m about to update the Sage 9 docs with this info, but try:

<img src="<?= App\asset_path('images/logo.png'); ?>">

1 Like

Great that works, thanks!