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

fix(v2): use SVGO in webpack SVGR loader #3691

Merged
merged 1 commit into from
Nov 6, 2020

Conversation

charleskorn
Copy link
Contributor

Motivation

Fix #3689.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Have verified changes on my own site, and scope of changes is small.

@facebook-github-bot
Copy link
Contributor

Hi @charleskorn!

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.

In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@charleskorn
Copy link
Contributor Author

I will have to get approval from my employer to sign the CLA - but please take a look at this (very small) change in the meantime and let me know if you foresee any issues.

@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built without sensitive environment variables with commit a882695

https://deploy-preview-3691--docusaurus-2.netlify.app

@slorber
Copy link
Collaborator

slorber commented Nov 5, 2020

LGTM

not sure why SVGO was disabled by default, hope it does not break anything for anyone, otherwise we'll provide a way to make this optim optional.

@slorber slorber changed the title Fix #3689 fix(v2): use SVGO in webpack SVGR loader Nov 5, 2020
@slorber slorber added the pr: bug fix This PR fixes a bug in a past release. label Nov 5, 2020
@charleskorn
Copy link
Contributor Author

I've just signed the CLA - hopefully this will come through shortly.

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Nov 5, 2020
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@slorber slorber merged commit c899117 into facebook:master Nov 6, 2020
@lex111 lex111 added this to the v2.0.0-alpha.67 milestone Nov 17, 2020
@Dudrie
Copy link

Dudrie commented Nov 27, 2020

..., hope it does not break anything for anyone, otherwise we'll provide a way to make this optim optional.

This actually broke something in my documentation. With alpha.66 the SVG output that got produced was:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24" height="24" viewBox="0 0 24 24">...</svg>

However, with the version alpha.69 the output is:

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">...</svg>

The viewBox attribute is missing and therefore any attempt to resize the image with CSS only resizes the outer box - the actual SVG path stays unchanged and gets clipped. I use inline SVGs and the SVG files do contain the viewBox attribute.

Should I open an extra issue for this?

@slorber
Copy link
Collaborator

slorber commented Nov 30, 2020

Yes @Dudrie please open an extra issue.

We may want to allow to enable/disable SVGO through config.
Also we may find a better default config that could work in your case?

That could help if you give more details: your full SVG code before/after optimization and screenshots etc

@Dudrie
Copy link

Dudrie commented Dec 9, 2020

I have opened an issue for this.

@charleskorn charleskorn deleted the master branch May 6, 2022 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: bug fix This PR fixes a bug in a past release.
Projects
None yet
6 participants