Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
example of how to use Sass runtime to generate IE-targeted stylesheets
// File: utils.scss
// Define mixins and default IE version in your utils include
$ie-version: 10 !default;
@mixin ie-max ( $max-version ){
@if $ie-version <= $max-version {
@content;
}
}
@mixin ie-min( $min-version ){
@if $ie-version >= $min-version {
@content;
}
}
// File: main.scss
// Reference specific styles for IE versions alongside the main code
.exampleThing {
@include ie-min(8){
/* this will export for good browsers, plus IE8 and above */
display: inline-block;
}
@include ie-max(7){
/* this will export for IE7 and below */
display: inline;
zoom: 1;
}
}
// File: ie7.scss
// Export a stylesheet like ie7.css by setting this in a root file and including what you need
$ie-version: 7;
@import "utils.scss";
@import "main.scss";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.