IE conditional comments with Sass and Bourbon

I want to use different fonts for different browsers (see this question ).

Is it possible to do this with Sass / Bourbon?

Here is what I still have:

<!--[if IE]> -->
@include font-face("myicons", "myicons", $weight: normal, $style: normal,
                   $asset-pipeline: false);
<![endif]-->
<!--[if !IE]> -->
@include font-face("myicons", "myicons", $weight: normal, $style: normal,
                   $asset-pipeline: true);
<![endif]-->
+4
source share
1 answer

This problem goes beyond the scope of sass, because it is just a preliminary processor and has no idea about the browser. In addition, the external conditions of css determine the conditions for different browsers.

You can do this by adding the ie8 class in html, like html5, and then use the css rule to activate the font.

body {
  @include font-face("myicons", "myicons", $weight: normal, $style: normal, $asset-pipeline: false);

  .ie8 & {
    @include font-face("myicons", "myicons", $weight: normal, $style: normal, $asset-pipeline: true);
  }
}

and in html file

<!--[if IE 8]>         <html class="ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html>         <!--<![endif]-->
+1
source

All Articles