Closed Antonytm closed 2 years ago
SVGO 2 has to be installed via NPM , it's not feasible to embed it into a nuget package anymore. The only way I can think of doing it is to include installation instructions and tips for running it on a build server for package and deployment.
Ok, I got you.
How about packaging svgo
to executable. Nowadays, it is very easy to do using https://github.com/vercel/pkg ?
Nowadays it is very easy: https://github.com/Antonytm/svgo-executable You can review GitHub actions.
Basically, there are just 2 lines of code:
npm install //package.json contains 2 package: pkg and svgo
npx pkg node_modules/svgo //build svgo > exe
I have created PR that is using svgo-win.exe that I got using the approach described above. https://github.com/kamsar/Dianoga/pull/105
Great find thanks mate, released in 6.0.0-beta.2
Version of Dianoga
5.4.1
Environment description:
Sitecore 9
What configs you have enabled
Standard. Only Dianoga.Svg.config is enabled
Reproducible steps (1... 2... 3...) that cause the issue
--disable=removeViewBox
argument toAdditionalToolArguments
This is configured based on examples in
SvgOptimizerTests.cs
.What you expected to see, versus what you actually saw
Expected result:
viewBox
property inside SVG file should not be touched.Actual result:
viewBox
property is removed.If we look on https://github.com/twardoch/svgop/blob/master/src/app/svgop-pkg.js we understand why it doesn't work. Configs are baked in to .exe.
Relevant logs
No logs.
Test should fail
There is a test
that run
svgop.exe
with--disable=removeViewBox
args. But if we checknew StreamReader(args.Stream).ReadToEnd()
we will see thatviewBox
was removed from test image.My thoughts
I think that we need to revert back to SVGO from SVGOP.