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(image-size-runtime.html): exclude SVG images from Perf: properly … #6318

Merged

Conversation

williamsdyyz
Copy link
Contributor

@williamsdyyz williamsdyyz commented May 15, 2024

…size image warnings

SVG is a vector format. Attributes like width, height & viewbox are not relevant to the size in bytes of the image, so the Perf: properly size image warning is incorrect.

Overview

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests / types / typos

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Use cases and why

    1. One use case
    1. Another use case

Checklist:

  • My code follows the developer guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • Added new tests to cover the fix / functionality

…size image warnings

SVG is a vector format. Attributes like width, height & viewbox are not relevant to the size in
bytes of the image, so the Perf: properly size image warning is incorrect.
Copy link

netlify bot commented May 15, 2024

👷 Deploy request for qwik-insights pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit c0b5e78

@thejackshelton
Copy link
Member

Hey @williamsdyyz! Is there an example SVG you can give so that I can confirm whether the warning went away after this PR?

I tried reproducing, but was unsuccessful.

@williamsdyyz
Copy link
Contributor Author

This is one of the files I used

flagen-US

PatrickJS
PatrickJS previously approved these changes May 15, 2024
@thejackshelton
Copy link
Member

@williamsdyyz sorry to bug you, but how do I reproduce the perf: size too big warning?

I have tried using it as an svg and add the svg as an image with a large, also trying to add large width and height attributes. Even adding massive images from unsplash, no luck there.

And this is with 1.5.4, not with your current PR version. I can't seem to get the warning.

Maybe you have a reproduction I could view?

@PatrickJS PatrickJS dismissed their stale review May 15, 2024 21:38

need repro

@PatrickJS PatrickJS added the STATUS-2: needs reproduction Issue lacks reproduction label May 15, 2024
@williamsdyyz
Copy link
Contributor Author

@thejackshelton no problem. I created a new Qwik project with pnpm creater qwik@latest and... couldn't reproduce it.

Did some digging. I had added Tailwind to my original project. Did more digging. Turns out it's one of Tailwind's default styles.

Try this code. The img with height:auto has the problem, the other doesn't.

import { component$ } from "@builder.io/qwik";
import flag from "./flagen-US.svg";

export default component$(() => {
  return (
    <>
      <img src={flag} width={24} height={24} style={{ height: "auto" }} />
      <br />
      <br />
      <img src={flag} width={24} height={24} />
    </>
  );
});

@thejackshelton
Copy link
Member

Appreciate the patience here! Tested and everything looks good 👍 .

Merging.

@thejackshelton thejackshelton merged commit a738299 into QwikDev:main May 20, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STATUS-2: needs reproduction Issue lacks reproduction
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants