今日已更新 281 条资讯 | 累计 21147 条内容
关于我们

How to properly serve SVG files from crossorigin?

/u/Nonilol 2026年06月03日 17:44 4 次阅读 来源:Reddit r/webdev

On a website of mine I use around ~50 different tiny SVG icons (1-2KB) per page which I store on a seperate subdomain where I host all my static files that I use across multiple websites. I am wondering what would be the best way to serve those. SVG sprites (a single svg file with each icon wrapped in a symbol tag): Not supported from crossorigin unless weird javascript hacks are being used. 1 request per icon : Seems a bit crazy to do 50+ requests for tiny files? Even with modern http2 this seems to slow the site down and feels like it causes unecessary overhead. Bake SVG into html : This feels the fastest, but it adds like 50kb (a bit less when gzipped) to every html page which seems unecessary as well. How do you do it? What is considered best practice? submitted by /u/Nonilol [link] [留言]

本文内容来源于互联网,版权归原作者所有
查看原文