I’m using Imagekit for hosting my images and I’m trying to figure out the best way to access them in my blade templates. Is this a job for Vite, acorn, handle directly in Sage as a function, or Acorn? There seems to be multiple ways to achieve this but nothing is noted or even suggested in the docs Help me find a path!
Ok, I have tried to install acorn and broken my local development instance. I’ve put in the code into my functions.php and now I just get the error that acorn is not installed.
This is my require fields in composer.json in my Sage theme
Hi. You should of only had to create a config folder in your theme and copy over the file that Ben linked. Sage 11 otherwise already has Acorn booted in functions.php.
ok, I’ve taken out the acorn code from my functions.php and I have my site running but I still don’t know how I use acorn to render my images in a blade template. I’ve have the config but I can’t find anything in the Acorn or Sage docs about using images? What am I calling to use that manifests → theme → url?
I assume if you access an image with something like wp_get_attachment_image() – Function | Developer.WordPress.org their plugin will automatically filter the URL appropriately. This wouldn’t really be related to Sage or involve anything with Vite/Acorn unless you are trying to offload your compiled assets. If you were offloading your assets and needed to adjust the endpoint URL, that’s when you’d pull in and configure config/assets.php.