Sass mixin 无法编译?
我之前在 sass 2.2.22 中为我的字体大小制作了一个 mixin(它是一个字体转换器),如下所示:
=6.5pts
:font
:size 9px
自从我一年前第一次制作它以来,它就一直在工作。我们刚刚升级到 haml/sass 3,现在每当我尝试刷新正在处理的页面时,都会出现 sass 编译错误,如下所示:
我不明白,因为 Sass 3 文档说 mixins 的 = 声明并未被弃用。我尝试卸载 haml 3.0,重新启动服务器并删除生成的 css 文件,现在它显然可以工作了。问题是,我需要 haml 3 用于我们刚刚开始使用 Compass 的另一个相关项目。
当文档声称该声明未被弃用时,为什么编译器会抱怨?
I have previously made a mixin in sass 2.2.22 for my font sizes(it's a font converter), like so:
=6.5pts
:font
:size 9px
It has been working ever since i first made it a year ago. We just upgraded to haml/sass 3 and now whenever I try to refresh the page im working on, a sass compile error appears like so:
I don't get it since Sass 3 documentation says that the = declaration for mixins is NOT deprecated. I tried uninstalling haml 3.0, restarted my server and deleted the generated css file and now it apparently works. Problem is, I need haml 3 for another related project where we just started using Compass.
Why is the compiler complaining when the documentation claims the declaration is not deprecated?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SASS-latest continue 是否允许混合名称 a) 以数字开头和 b) 包含句点?
从 SASS 文档来看,“SassScript 变量和 mixin 名称现在可以包含连字符。事实上,它们可以是任何有效的 CSS3 标识符。”这告诉我,不构成有效 CSS3 标识符的文本可能不构成有效的 SASS 变量或 mixin 名称。
CSS 文档中指出,“在 CSS 中,标识符(包括选择器中的元素名称、类和 ID)只能包含字符 [a-zA-Z0-9] 和 ISO 10646 字符 U+00A1 及更高版本,加上连字符 ( -) 和下划线 (_);它们不能以数字或连字符后跟数字开头。”请注意,句点的 Unicode 代码点为 U+002E。
如果 SASS 早期允许您使用以数字开头或包含句点的变量和混入名称,那么这种行为可能从未被预期,并且现在可能已不再受支持。
有什么值得研究的。
Does SASS-latest continue permit mixin names a) beginning with a numeral and b) containing a period?
From the SASS docs, "SassScript variable and mixin names may now contain hyphens. In fact, they may be any valid CSS3 identifier." This tells me that text which does not constitute a valid CSS3 identifier may not constitute a valid SASS variable or mixin name.
From the CSS docs, "In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, or a hyphen followed by a digit." Note that the period has Unicode codepoint U+002E.
If SASS-earlier let you get away with variable and mixin names either beginning with a numeral or containing a period, then this behavior might never have been intended and might now have been dropped from support.
Something to look into.
你可能需要这样说:
在参考文献中查看一个完美的例子: http://sass-lang.com/docs/yardoc/file.INDENTED_SYNTAX.html#mixin_directives
you probably need to put it like this:
see a perfect example in the reference: http://sass-lang.com/docs/yardoc/file.INDENTED_SYNTAX.html#mixin_directives