Open philwolstenholme opened 4 years ago
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.
@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!
In the README file we say:
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.