Show HN: Make external SVG files styleable with CSS through injection
github.com
github.com
In other words you can do this in react now without any extra "stuff". Syntax:
import { ReactComponent as Logo } from './logo.svg';
1. Upload huge sets of normal SVG files.
2. Once adoption grows, swap them out for nefarious SVGs.
3. Wait.
The way it was solved in the older version of the project which we had to rewrite was that they automatically generated these blips each time a user changed their profile color or avatar and they had no server-side clustering so they'd always send the data for every user for a specific zoom level (which was not very optimal for large numbers of users, needless to say).
So I ended up using a template engine on the front-end for the SVG files. The choice in the ended fell to Nunjucks, since we were already using Symfony with Twig on the back-end and the syntax for Nunjuck is more or less the same. I made a template for the blips that would change either render a cluster marker and expect a user number as a variable or a user marker that would expect a hex color and the URL to a profile photo. Nunjucks took care of the grabbing the template and rendering each blip with the content for LeafletJS.
Server side injection with PHP is certainly possible, but this usually does not take care of the IDs properly, so you may run into trouble in some cases. Also, for dynamic web pages server side injection could be difficult.