With propshaft it is possible to easily get the content of an asset. This is mainly useful if you want to inline an SVG. Instead of rendering an <img /> tag which references the SVG, the SVG can be inlined directly into the HTML.

= Rails.application.assets.load_path.find('my_icon.svg').content.html_safe

This is especially useful when the SVG uses currentColor. Only inline SVG use the current color from the parent HTML.

If you are not using propshaft, have a look at the inline_svg gem.