Conversation
|
Thank you for your contribution! 🎉 🔔 @1weiho you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. Due to our current reduced availability during summer, the initial review may take up to 10-15 business days. |
There was a problem hiding this comment.
Greptile Summary
This PR adds SVG ID prefixing functionality to the svgl extension to prevent conflicts when multiple SVGs are used together. The implementation introduces two new utility functions in prefix-svg.ts: getPrefixFromSvgUrl() which generates a unique prefix from SVG URLs by extracting the filename and converting hyphens to underscores, and prefixSvgIds() which uses regex to replace both id attributes and url() references in SVG content with prefixed versions.
The core integration happens in the existing fetchSvg() function in utils/fetch.ts, where all fetched SVGs are automatically processed to apply the prefixing. This addresses a common web development issue where SVG elements with identical internal IDs (like gradients, masks, or patterns) can cause rendering conflicts when multiple SVGs are displayed on the same page. The solution is particularly valuable for the svgl extension since users frequently copy multiple SVG logos that may share common ID patterns from similar authoring tools.
The CHANGELOG entry properly documents this enhancement using the required {PR_MERGE_DATE} format and is correctly positioned at the top. A minor JSON formatting improvement in package.json adds proper spacing for consistency.
Confidence score: 3/5
- This PR introduces a potentially breaking change to cached SVG content without updating cache keys
- Score reflects concern about existing cached SVGs that may break since cache keys remain unchanged but content format is modified
- Pay close attention to
utils/fetch.tsfor the cache invalidation issue
4 files reviewed, 1 comment
pernielsentikaer
left a comment
There was a problem hiding this comment.
Hi 👋
Looks good to me, approved 🔥
|
Published to the Raycast Store: |
|
🎉 🎉 🎉 We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag. |
Description
Add the script to prefix the SVG IDs to avoid conflicts with other SVGs.
Screencast
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare located outside the metadata folder if they were not generated with our metadata tool