Use SVGO to optimize uploaded SVGs

Created on 10 March 2023, almost 2 years ago
Updated 17 October 2023, about 1 year ago

One of our clients has uploaded SVGs with conflicting <style> tags. This causes SVGs to be rendered differently based on the order of them being loaded in the HTML DOM. See this Github issue for a concise example.

This could be resolved by using SVGO to optimize the SVG by inlining the colors. There is a Composer package available for this: https://packagist.org/packages/spatie/image-optimizer

SVGs might break when optimizing, especially animated ones. So it should be optional for each SVG.

My suggestion would be to add a boolean field to the taxonomy term so the user can choose to optimize the SVG or not.

Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

🇧🇪Belgium beerendlauwers

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024