LeaVerou / css-almanac

Repo for planning & voting on which stats to study
https://projects.verou.me/mavoice/?repo=leaverou/css-almanac&labels=proposed%20stat
33 stars 3 forks source link

Which media query features are used most? #30

Open tomhodgins opened 4 years ago

tomhodgins commented 4 years ago

I've wondered for years the web-wide usage of media query features and wanted answers to questions like:

LeaVerou commented 3 years ago

Alright, so @media rules have "type": "media" in the Rework AST and their condition can be found under the media property, unparsed (e.g. "(max-width: 300px) and (min-height: 200px)"), so to extract these we'd need to parse it ourselves and then count the things mentioned in the first post, namely:

Anything else?

rviscomi commented 3 years ago

@LeaVerou does the JS answer the "common breakpoints" question?

LeaVerou commented 3 years ago

Oops, nope, the current JS discarded values and only aggregated the features tested. I just pushed another JS file (30-media-queries.js) that aggregates the entire queries instead so we can find common ones.

Note that this will produce separate breakpoint results for e.g. min-width and max-width, which I think is ok, and even interesting. But if we just want to find lengths, regardless of feature, it would need different JS.