[openstreetmap/openstreetmap-website] Can we avoid inlining svgs into erb templates? (Issue #5880)

Andy Allan notifications at github.com
Wed Apr 2 18:26:14 UTC 2025


gravitystorm created an issue (openstreetmap/openstreetmap-website#5880)

I've seen a lot of PRs recently where we are inlining SVGs into the output html, rather than having them as sprites or standalone images. I can see the benefit of doing so, particularly for the ability to set `stroke="currentColor"`.

However, there are some downsides of putting them in the erb templates. It makes the icons hard to edit, for example with tools like Inkscape (without a lot of copy+pasting back and forward). For some erb templates it can also become a large amount of effectively "binary" data on show - it's not really possible to read the `path` and figure out what it shows or how to edit it, and so it's not much different than having inline PNG data.

Is there another approach that we can use, that allows the SVGs to be inlined in the output, but kept as separate SVG files in the source code? Perhaps some `inline_svg` helpers that can read the files, output either the desired paths or the whole file, and that makes any changes required to convert the input file into what we want to output (e.g. changing the stroke colour) automatically?

@hlfan @AntonKhorev you both have the most experience with these, is there something that I haven't considered?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/5880
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/5880 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250402/14ccf9ff/attachment-0001.htm>


More information about the rails-dev mailing list