Skip to content

Commit 29e87be

Browse files
authored
Merge pull request #146 from hansspiess/ms-respond-important
Add parameter to ms-respond() to render all rules with !important
2 parents ce305e4 + fcc51cf commit 29e87be

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

stylesheets/modularscale/_respond.scss

+10-4
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,27 @@
99
}
1010

1111
// Main responsive mixin
12-
@mixin ms-respond($prop, $val, $map: $modularscale) {
12+
@mixin ms-respond($prop, $val, $map: $modularscale, $ms-important: false) {
1313
$base: $ms-base;
1414
$ratio: $ms-ratio;
1515

1616
$first-write: true;
1717
$last-break: null;
1818

19+
$important: '';
20+
21+
@if $ms-important == true {
22+
$important: ' !important';
23+
}
24+
1925
// loop through all settings with a breakpoint type value
2026
@each $v, $s in $map {
2127
@if type-of($v) == number {
2228
@if unit($v) != '' {
2329

2430
// Write out the first value without a media query.
2531
@if $first-write {
26-
#{$prop}: ms-function($val, $thread: $v, $settings: $map);
32+
#{$prop}: ms-function($val, $thread: $v, $settings: $map)#{$important};
2733

2834
// Not the first write anymore, reset to false to move on.
2935
$first-write: false;
@@ -35,7 +41,7 @@
3541
@media (min-width: $last-break) and (max-width: $v) {
3642
$val1: ms-function($val, $thread: $last-break, $settings: $map);
3743
$val2: ms-function($val, $thread: $v, $settings: $map);
38-
#{$prop}: ms-fluid($val1,$val2,$last-break,$v);
44+
#{$prop}: ms-fluid($val1,$val2,$last-break,$v)#{$important};
3945
}
4046
$last-break: $v;
4147
}
@@ -46,7 +52,7 @@
4652
// Write the last breakpoint.
4753
@if $last-break {
4854
@media (min-width: $last-break) {
49-
#{$prop}: ms-function($val, $thread: $last-break, $settings: $map);
55+
#{$prop}: ms-function($val, $thread: $last-break, $settings: $map)#{$important};
5056
}
5157
}
5258
}

0 commit comments

Comments
 (0)