flyntwp / flynt

Component based WordPress starter theme, powered by ACF Pro and Timber, optimized for a11y and fast page load results.
https://flyntwp.com
MIT License
735 stars 84 forks source link

Get url dist assets from twig #413

Closed darksns closed 3 years ago

darksns commented 3 years ago

Hi, is there a method/filter on twig to retrieve the url of an image inside the assets/images folder? After I run the 'npm run build' command obviously it is appended to the file name '-0123456' Thank you

steffenbew commented 3 years ago

Hi @darksns, yes there is the following function to retrieve the file path of built assets:

use Flynt\Utils\Asset;

$logoPath = Asset::requireUrl('Components/NavigationBurger/Assets/logo.svg')