We've moved discussions to Discord

render_svg() doesn't work on Heroku

Ryan Kulp
i used:
render_svg "icons/question", styles: "..."

which worked locally. then in production (Heroku):
<svg>
  <!-- SVG file not found: 'icons/question.svg' -->
</svg>

changed to:
image_tag "icons/question.svg"

which works OK.

Chris Oliver
Oh interesting, I'll have to check this out and see what's causing that. Working fine when deploying to Hatchbox so I assumed Heroku would do fine. It just reads the file off disk so I can't think of a reason why it couldn't find it off the top of my head.
Chris Oliver
This is fixed! The inline_svg gem we're using changed how it worked and was only looking in Webpacker for images, which we're not doing. The latest version fixed the problem.

bundle update inline_svg
Ryan Kulp
aha, thanks! 
Ryan Kulp
i used:
render_svg "icons/question", styles: "..."

which worked locally. then in production (Heroku):
<svg>
  <!-- SVG file not found: 'icons/question.svg' -->
</svg>

changed to:
image_tag "icons/question.svg"

which works OK.

Chris Oliver
Oh interesting, I'll have to check this out and see what's causing that. Working fine when deploying to Hatchbox so I assumed Heroku would do fine. It just reads the file off disk so I can't think of a reason why it couldn't find it off the top of my head.
Chris Oliver
This is fixed! The inline_svg gem we're using changed how it worked and was only looking in Webpacker for images, which we're not doing. The latest version fixed the problem.

bundle update inline_svg
Ryan Kulp
aha, thanks! 
Notifications
You’re not receiving notifications from this thread.
© 2023 Jumpstart Pro by GoRails, LLC