You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even if the issue is because of a dependent package, it is important to track it until it is supported and be transparent to developers that use style variables.
Are you using the latest version of sharp?
I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.
What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?
As a fallback, I'm converting all variables to their actual value. My simple assets use color codes only, so other cases may need a more refined approach.
// match all: --varName:#ff00ff;
const regexp = /(--)[a-zA-Z]+:#[a-fA-F0-9]+;/g;
const vars = [..._svg.matchAll(regexp)];
for (const v of vars) {
const parts = v[0].split(':');
const name = parts[0]; // --varName
const value = parts[1].split(';')[0]; // #ff00ff
svg = svg.replaceAll(`var(${name})`, value);
}
Possible bug
SVG conversion to PNG ignores <style> variables.
This issue limits compatibility with several of the assets I am using, and with 100% that I generate.
Maybe... this could be because of libvips, which uses librsvg. Acccording to this post, they still do not support style variables:
https://gitlab.gnome.org/GNOME/librsvg/-/issues/459
Even if the issue is because of a dependent package, it is important to track it until it is supported and be transparent to developers that use style variables.
Are you using the latest version of sharp?
sharp
as reported bynpm view sharp dist-tags.latest
.What is the output of running
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
?What are the steps to reproduce?
What is the expected behaviour?
Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem
This is a nextjs api endpoint:
Please provide sample image(s) that help explain this problem
The text was updated successfully, but these errors were encountered: