Open tomhodgins opened 4 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:
min-
features vs max-
features.height
features vs width
featuresmin-width
and max-width
Anything else?
@LeaVerou does the JS answer the "common breakpoints" question?
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.
I've wondered for years the web-wide usage of media query features and wanted answers to questions like:
min-
ormax-
features used more prevalently?width
features compare toheight
for responsive design?print
media type is out there?width
-based breakpoints, what are the commonly used breakpoints