-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add respond-to() syntax to apply breakpoints #37
Labels
Comments
ao2
added a commit
to ao2/megatype
that referenced
this issue
Jul 8, 2017
The respond-to() mixin introduced by http://breakpoint-sass.com/ improves the readability of the source stylesheet allowing to apply media queries using meaningful names instead of numbers. Add such mechanism to megatyoe too. The code is heavily inspired by http://breakpoint-sass.com/ this should be OK because its license is MIT and hence compatible with megatypes. Fixes Issue TodayDesign#37
I am also wondering if adding an optional Right now the media query generated by Something along these lines: diff --git a/megatype/_media.scss b/megatype/_media.scss
index 596727b..069a459 100644
--- a/megatype/_media.scss
+++ b/megatype/_media.scss
@@ -10,7 +10,7 @@
// Media queries. Accepts px or em
// Defaults to min-width, but both min->max and max-width are available too.
// Parts based on https://gist.github.com/timknight/03e6335b8816aa534cf7
-@mixin media($min: 0, $max: 0) {
+@mixin media($min: 0, $max: 0, $extra_query: null, $extra_query_operator: "and") {
// Type of break variable
$min-val: type-of($min);
$min-unit: unit($min);
@@ -92,7 +92,11 @@
}
@if $query != "all" {
- @media #{$query} { @content; }
+ @if $extra_query {
+ @media #{$extra_query} #{$extra_query_operator} #{$query} { @content; }
+ } @else {
+ @media #{$query} { @content; }
+ }
} @else {
@error "#{$min} and #{$max} did not resolve to a valid media query, styles not output";
}
Would allow to write: @include add-breakpoint-alias('medium screen', (1, 3, "screen")); |
Hi, any ETA for this? Thanks, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I find the
respond-to()
syntax used for instance by http://breakpoint-sass.com/ very handy: it improves the readability of the scss code and I am also quite used to it, so I would like to have it available in megatype.I have a prototype already, I am going to send a pull request for review.
AFAICS it's not advisable to use breakpoint-sass together with megatype because that would introduce inconsistencies wrt. the root fontsize, so the support has to be added to megatype itself and based on the `media()' mixin which handles the root font size change.
Ciao,
Antonio
The text was updated successfully, but these errors were encountered: