[openstreetmap/openstreetmap-website] Browse icons as svg (PR #5080)

mmd notifications at github.com
Fri Aug 16 06:43:39 UTC 2024


Thank you for clarifying! I think it would be a bit challenging to always include all symbol svg files in the browse page due to their total size (around 200K).

I thought about adding some configuration table to move most of the logic from browse.scss to a yml file (at least for svg). For this purpose I have introduced a new config/browse_image.yml, and the corresponding initializer in config/initializers/browse_image.rb.

In some cases the same image is used for different tags, so we would need some sort of configuration anyway to map tags to svg images and define how they should be filled.

```
irb(main):001> BROWSE_IMAGE["shop_pet".to_sym]
=> {:image=>"shop_pet.svg", :fill=>"shop"}
```

In the next step BROWSE_IMAGE can then be used in helpers/browse_helper.rb to find out if an SVG exists for a "{key}_{value}", and then use the external_svg approach I mentioned in my previous post.




-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5080#issuecomment-2292918549
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5080/c2292918549 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240815/76859b95/attachment.htm>


More information about the rails-dev mailing list