【问题标题】:Compass: Syntax error: Undefined mixin 'user-select'指南针:语法错误:未定义的 mixin 'user-select'
【发布时间】:2013-07-09 17:34:33
【问题描述】:

尝试使用 mixin 'user-select' 时出现以下错误。我使用的是 0.12.2 版本,我很确定它支持来自 compass 的 user-select。那么为什么我不能使用这个mixin呢?

错误

 Syntax error: Undefined mixin \'user-select\'

包括

// css3
    @import "compass/css3";
    @import "partials/deposit";

致电

//File: partials/_deposit.scss
@include user-select(none);

那么为什么我不能使用这个 mixin?

【问题讨论】:

  • 没有尝试导入完整的compass/css3,而是尝试@import "compass/css3/user-interface" 进行测试?
  • 我只是在阅读评论之前尝试过。但添加它作为答案,我会接受。
  • 你为什么不直接做@import 'compass';?这样可以省去很多麻烦。
  • 不想臃肿穿:|

标签: css sass compass-sass


【解决方案1】:

来自@import "compass/css3/",这是导入的东西列表:

  • 外观 – 指定 CSS3 外观属性。
  • 背景剪辑 – 指定所有浏览器的背景剪辑。
  • Background Origin – 指定所有浏览器的背景来源。
  • 背景尺寸 - 指定所有浏览器的背景尺寸。
  • 边框半径 - 指定所有浏览器的边框半径。
  • Box - 此模块提供与 CSS3 灵活框相关的 mixin。
  • Box Shadow – 指定所有浏览器的盒子阴影。
  • Box Sizing – 指定所有浏览器的 box 大小。
  • – 为所有浏览器指定列式布局。
  • 过滤器 – 为所有浏览器指定(图像)过滤器。
  • 字体 - 为所有浏览器指定可下载的字体。
  • 连字符 - Mixin 用于打破空间并将连字符注入溢出的文本中
  • 图像 - 为许多浏览器指定线性渐变和径向渐变。
  • 内联块 - 为所有浏览器声明一个元素内联块。
  • 不透明度 - 指定所有浏览器的不透明度。
  • CSS 区域 - 为支持的浏览器指定 CSS 区域。
  • 文本阴影 - 指定所有浏览器的文本阴影。
  • Transform - 为许多浏览器指定转换。
  • Transition – 为所有浏览器指定样式过渡。

由此,我们可以说 Compass 用户界面 (css3/user-interface) 没有与 compass/css3 绑定,因此您还需要在 css3 调用之后调用它:

@import "compass/css3"
@import "compass/css3/user-interface"
//other imports

更新

指南针 0.13.alpha.10 以后

自从 documentation page 更新后,看起来像 0.13.alpha.10 Compass imports user-interface as well

  • 用户界面 - 为所有浏览器声明一个元素内联块。

还添加了动画:

  • 动画 – 指定 CSS3 动画属性及其所有子属性。

因此现在只需@import "compass/css3" 就足够了。

【讨论】:

  • oooo,非常好。不知何故,我错过了这个文档。 +1 仅此一项 :)
  • @JamieHutber 刚刚更新了答案,似乎他们终于添加了user-interface 作为css3 导入的一部分:P
  • wohoooo 让我的问题变得多余,哪个 imo 实现了梦想!
  • @JamieHutber Heh 至少把它留在那里,旧指南针的人仍然会遇到问题,看看我得到了多少赞,哈哈,这个问题似乎很常见。
猜你喜欢
  • 2014-08-12
  • 1970-01-01
  • 2011-01-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-30
  • 1970-01-01
  • 2012-02-21
相关资源
最近更新 更多