Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhodgins/e6cebe6bdb3304d59cb0c94bf3f61daf to your computer and use it in GitHub Desktop.
Save tomhodgins/e6cebe6bdb3304d59cb0c94bf3f61daf to your computer and use it in GitHub Desktop.
/*
Here's one way you might be able to use the concept of having a defined set
of named breakpoints in CSS for the purpose of preprocessing media queries.
Imagine you have a global configuration where your breakpoints are listed,
along with the associated names, then you are able to write other CSS targeting
those named breakpoints:
*/
:root {
--media-query: --breakpoints(
320px phone
768px tablet
1024px desktop
);
}
@supports (--breakpoint(phone)) {}
@supports (--breakpoint(tablet)) {}
@supports (--breakpoint(desktop)) {}
/* This could be transformed into or interpreted as this kind of CSS output: */
@media (min-width: 320px) {}
@media (min-width: 768px) {}
@media (min-width: 1024px) {}
/*
So there might be all sorts of other applications for a special value syntax
for the concept of "named breakpoints" no matter what that syntax looks like.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment