Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extend to work across media directives when the queries are compatible. #501

Open
chriseppstein opened this issue Aug 24, 2012 · 7 comments
Labels
enhancement New feature or request planned We would like to add this feature at some point

Comments

@chriseppstein
Copy link

Consider:

@media screen and (min-width: 500px) {
  .foo { color: red; }
}

@media screen and (min-width: 400px) {
  .bar { @extend .foo; }
}

This will generate a deprecation warning. But in all cases where .foo is defined, the media query it is in is a propery subset of the media query where .bar is defined. So this it is safe for sass to perform this operation.

@nex3
Copy link
Contributor

nex3 commented Aug 24, 2012

I'm not sure we want to perform the operation for this query in particular, since that requires knowledge of the semantics of min-width.

@nathggns
Copy link

Call the the value of the first media query x (500) and the value of the second y (400).

It's easy enough to do some simple logic based on the prefixes.

min = x > y
max = x < y
no prefix = x = y

You don't really need to care out the property.

@chriseppstein
Copy link
Author

Yep, @nathggns is right, the semantics of min/max are standardized in media queries -- this can be done safely.

@nex3
Copy link
Contributor

nex3 commented Aug 24, 2012

I'm uncomfortable with the general principle of that level of semantic knowledge about the specific media queries. Understanding that screen and X is a subquery of screen is one thing; understanding what min-width means is another.

@nathggns
Copy link

You don't need to understand what min-width means, as I just explained.

Nathaniel Higgins
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Friday, 24 August 2012 at 22:45, Nathan Weizenbaum wrote:

I'm uncomfortable with the general principle of that level of semantic knowledge about the specific media queries. Understanding that screen and X is a subquery of screen is one thing; understanding what min-width means is another.


Reply to this email directly or view it on GitHub (#501 (comment)).

@chriseppstein
Copy link
Author

I'm not uncomfortable with this. Min and max have well established meanings in the spec -- independent of the property names they are attached to.

@nex3
Copy link
Contributor

nex3 commented Aug 24, 2012

Oh, I see, I misunderstood. That does make it better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned We would like to add this feature at some point
Projects
None yet
Development

No branches or pull requests

3 participants