Make the at-query more intuitive for min-max calls#359
Make the at-query more intuitive for min-max calls#359jtgrenz wants to merge 1 commit intoShopify:masterfrom
Conversation
|
This adds some welcomed smarts to a function that isn't as intuitive as it could be. I can't comment on the actual code edit, I am not an experienced Sassy coder, but I like that we can call the function with a min and max values. 👍 |
|
@cshold what do you think? |
|
Looks like a smart way to call the function, and I like that it still works with the long syntax. Let me test it out a bit tomorrow and get back to you. |
|
@Shopify/fed Thoughts on this approach to make a more intuitive |
|
I'm a bigger fan of using named arguments. |
|
I as well, but this is an improvement I think |
|
The type-of check seems brittle to me. What if someone does at-query('100px')? |
|
@AWaselnuk There is an article on casting string values to numbers but its definitely overkill. |
|
Agreed that casting would be a bad idea. |
|
Opened #367 to include link to docs and slight syntax update. |
I modified the at-query mixin to make calling values of in-between a little more intuitive.
Currently if you want to define a media query between two ranges, say small and medium, you'd write:
@include at-query(null, $small, $medium) { ... }I don't like passing in null values and sass is smart enough to figure out whats what. So with this change,
@include at-query(null, $small, $medium) { ... }and@include at-query( $small, $medium) { ... }are identical.if you were used to adding null to do an in-between, it works, but if you wanted a short hand, that works too.
@carolineschnapp