Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compress an SVG error? #3645

Closed
hamishwillee opened this issue Apr 27, 2021 · 5 comments
Closed

Compress an SVG error? #3645

hamishwillee opened this issue Apr 27, 2021 · 5 comments

Comments

@hamishwillee
Copy link
Contributor

I'm getting a CI error on mdn/content#4505 asking me to run --save-compression on and SVG. That's a bug right?

@peterbe
Copy link
Contributor

peterbe commented Apr 27, 2021

It's not a bug. The imagemin-svg library can turn that .svg file into a smaller .svg file. It does this by stripping extraneous whitespace and quoted attributes that can be spared.

The problem is that this will force you to kinda ruin the file. It's a bit like saying; Your Photoshop file can be turned into a smaller JPG file! Fix it now!
But, like a Photoshop original file, you might want to open this .svg and work on it for a future revision. Hmm.

It's all happening because Yari expects the file attachments checked into the git repo to be perfect for serving. And here might be an exception because you might not want to optimize the .svg.

One solution is to upload the .svg some other place. Like a dedicated git repo, a Gdrive, Dropbox, or S3 :) ...and then only check in the hyper-optimized .svg file into mdn/content. But all of that kinda sucks.

@hamishwillee
Copy link
Contributor Author

@peterbe Yes, so as you imply, I did create this as an SVG to ease future editing (the original being in lucidcharts). Note that I use tools for editing - inkscape - which presumably would not be broken just by minification.

I would prefer to keep this with the docs. Could we make an exception for SVGs? Or perhaps have a rule that says a file under /uncompressed/ subfolder can exist uncompressed for exceptions?

@peterbe
Copy link
Contributor

peterbe commented Apr 28, 2021

I would prefer to keep this with the docs. Could we make an exception for SVGs? Or perhaps have a rule that says a file under /uncompressed/ subfolder can exist uncompressed for exceptions?

Mayhaps. Probably not quickly. I think we can start a chat about treating SVGs differently but if you want to get your content PR landed I think it's best to run the compression now and get CI to pass. Then, we can discuss changing the rules for .svg files.
Does that make sense?

@Ryuno-Ki
Copy link

I took the liberty to fill #3652

@hamishwillee
Copy link
Contributor Author

I am closing this, as it is not an error but a feature. SVGs are still editable even if compressed, so my justification for not wanting to compress is gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants