@rem I do it server side at build time.
Because anything I can do ahead of time, I do ahead of time.
It doesn't add markup for me as it is done by my SSG (@eleven_ty) during the build.
One less thing to have as a client-side js dependency and on the render path.