Repository navigation
Build icons as plain SVG - #519
Open
firestar300 wants to merge 2 commits into
Open
firestar300 wants to merge 2 commits into
firestar300 wants to merge 2 commits into
Conversation
cedric07
reviewed
Oct 9, 2026
…ed as sprite or plain svg
Bugbot is paused — on-demand spend limit reachedBugbot uses usage-based billing for this team and has hit its on-demand spend limit. A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cette PR enrichit la chaîne de build et l’affichage des icônes SVG du thème :
dist/icons/, chaque SVG source soussrc/img/icons/est optimisé (SVGO) et copié dansdist/images/en conservant l’arborescence (sprite/,social/, etc.).get_the_icon()/the_icon()acceptent un 3ᵉ paramètre$is_sprite(défauttrue) pour choisir entre référence sprite (<use>) et SVG fichier inline.removeViewBoxobsolète qui provoquait un warning au build).Le comportement existant (sprites + cache-busting via
sprite-hashes.asset.php) reste inchangé par défaut.Changements techniques
config/webpack-icon-files-plugin.jsafterEmit) : lecturesrc/img/icons/**/*.svg→ écrituredist/images/**avecconfig/svgo.config.jsconfig/plugins.jsconfig/svgo.config.jspackage.jsonsvgo(utilisée par le plugin)inc/Services/Svg.php$is_sprite, parsing d’identifiant, chargement sécurisé du fichier, injection des classes sur la balise<svg>racineinc/Helpers/Svg.php$is_spriteExemples d’usage
Chemins générés côté build, par exemple :
src/img/icons/sprite/menu.svg→dist/icons/sprite.svg(sprite) etdist/images/sprite/menu.svg(fichier)src/img/icons/social/facebook.svg→dist/icons/social.svgetdist/images/social/facebook.svgTest plan
npm run buildsans erreur (vérifier l’absence du warning SVGOremoveViewBox)dist/icons/sprite.svg,dist/icons/social.svgdist/images/sprite/*.svg,dist/images/social/*.svgthe_icon( 'share' ), partage d’article, etc.) inchangées visuellementthe_icon( 'menu', [], false )— markup SVG complet dans le HTML, classesicon/icon-menuprésentesget_the_icon( 'social/facebook', [], false )— fichierdist/images/social/facebook.svgbien serviNotes
dist/images/(artefacts de build du thème) ; le chemin est validé viarealpathsousdist/images.svgo-loaderpour les sprites, plugin dédié pour les fichiers unitaires,imagemin-svgodans la minification d’images).