Compass / Sass自动生成IE css文件

时间:2012-10-18 12:54:53

标签: compass-sass sass

有没有办法自动生成IE特定文件,如下例所示?

   /* content.scss */
.box {
    color:red;
    .ie7 & {
        color:green;
    }
}

这会生成两个文件:

/* content.css */
.box {
  color: red;
}


/* ie7.css */
.ie7 .box {
  color: green;
}

1 个答案:

答案 0 :(得分:0)

你必须设置2个不同的Sass文件,但你可以使用自定义mixin来完成:

http://jakearchibald.github.com/sass-ie/

$old-ie: false !default;

@mixin old-ie {
    // Only use this content if we're dealing with old IE
    @if $old-ie {
        @content;
    }
}

.test {

    float: left;
    width: 70%;

    @include old-ie {
        // These hacks won't appear in the normal stylesheet
        display: inline;
        zoom: 1;
        whatever-ie-needs: le-sigh;
    }
}