If you want to keep everything under one roof and have only one HTTP request for your older browser visitors, you can do something like this
Setting up the initial mix of the response
// initial variables set-up $doc-font-size: 16; $doc-line-height: 24; // media query mixin (min-width only) @mixin breakpoint($point) { @media (min-width: $point / $doc-font-size +em) { @content; } }
this will create a min-width media query and output your px ($ point) value as the em value.
From this you need to create this mixin
@mixin rwdIE($name, $wrapper-class, $IE: true) { @if $IE == true { .lt-ie9 .#{$wrapper-class} { @content; } .#{$wrapper-class} { @include breakpoint($name) { @content; } } } @else if $IE == false { .#{$wrapper-class} { @include breakpoint($name) { @content; } } } }
Here, if you pass a piece of Sass (SCSS) like this
@include rwdIE(456, test) { background-color: #d13400; }
he will return this code
.lt-ie9 .test { background-color: #d13400; } @media (min-width: 28.5em) { .test { background-color: #d13400; } }
This will give you the IE and CSS of the new browser in a single file. If you write -
@include rwdIE(456, test, false) { background-color:
You'll get -
@media (min-width: 28.5em) { .test { background-color: #d13400; } }
I hope this helps, I also have it on the codec - http://codepen.io/sturobson/pen/CzGuI
source share