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

README file suggests this approach has a bigger performance impact than it actually does #27

Open
philwolstenholme opened this issue Apr 27, 2020 · 2 comments
Labels
documentation Everything related to documentation

Comments

@philwolstenholme
Copy link

In the README file we say:

It would be much better if a mobile user doesn't need to load desktop specific CSS, wouldn't it?

But the media attribute of a stylesheet doesn't actually prevent it from downloading on non-matching media queries:

https://blog.tomayac.com/2018/11/08/why-browsers-download-stylesheets-with-non-matching-media-queries-180513/

Instead, what happens is the CSS file is given a lower download priority.

It would be good if the README was updated to provide a more accurate description of the performance benefits that the approach of media query splitting actually gives.

@SassNinja
Copy link
Owner

Hi @philwolstenholme

I agree the wording might be misunderstood – any idea how that text should look?

Instead, what happens is the CSS file is given a lower download priority.

Furthermore the browser doesn't apply that styles so there's a performance gain (though not comparable with not loading the actual file)

I've mentioned "dynamic import" as a notice this plugin doesn't take care of this but you have to do it yourself.

@philwolstenholme
Copy link
Author

@SassNinja I've raised a PR with some suggested changes to the README that might be useful to people who are interested in this plugin but don't fully understand what the performance benefits would be :) Feel free to make any changes!

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

No branches or pull requests

2 participants