segmentio / myth

A CSS preprocessor that acts like a polyfill for future versions of the spec.
4.33k stars 131 forks source link

Define variables in media queries? #145

Open JamesCoyle opened 8 years ago

JamesCoyle commented 8 years ago

It seems this doesn't work but should according to the spec AFAIK. I read about it here.

@media screen and (max-width: 1280px) {
    :root {
        --total-width: 1000px;
    }
}

The above code should change the value of the --total-width variable if the media query is active. I believe when supported the browser should be able to handle this. To make it work with Myth though it would require pulling every definition where the variable is used up into the media query.