【问题标题】:Disable browser prefixes in SASS Compass? [duplicate]在 SASS Compass 中禁用浏览器前缀? [复制]
【发布时间】:2025-11-28 00:40:02
【问题描述】:

有没有办法禁用 Compass 添加的所有浏览器前缀?

示例;

.heartbeat {
  @include animation(heartbeat 0.5s linear infinite);
}

生成这个:

.heartbeat {
    -moz-animation    : heartbeat .5s linear infinite;
    -webkit-animation : heartbeat .5s linear infinite;
    animation         : heartbeat .5s linear infinite
}

但我想要的是这个:

.heartbeat {
    animation         : heartbeat .5s linear infinite
}

是的,我可以简单地替换

.heartbeat {
  @include animation(heartbeat 0.5s linear infinite);
}

.heartbeat {
  animation(heartbeat 0.5s linear infinite);
}

但我不想修改 SASS 代码。

【问题讨论】:

  • 你可以tune some variables,但你为什么要这么做?
  • 因为我想使用 GULP Autoprefixer 而不是必须使用 Compass 方法。

标签: css sass compass-sass compass


【解决方案1】:

我通过这样做解决了它:

compass interactive
browsers()

得到所有支持的浏览器:

("android", "android-chrome", "android-firefox", "blackberry", "chrome", "firefox", "ie", "ie-mobile", "ios-safari", "opera", "opera-mini", "opera-mobile", "safari")

最后将其添加到 sass 文件中:

$supported-browsers: reject(browsers(), "android", "android-chrome", "android-firefox", "blackberry", "chrome", "firefox", "ie", "ie-mobile", "ios-safari", "opera", "opera-mini", "opera-mobile", "safari");

【讨论】:

  • 奇怪的是,不可能只是反过来将我想要支持的一个浏览器列入白名单。