无法让指南针生成图标精灵
我对 Compass 相当陌生,但我一直在尝试在项目中使用 Compass 来生成我的图标精灵。请参阅本教程:
IMO,教程不太清楚。首先,本教程从未告诉您创建包含“all-icon-sprites”mixin 的“_icons.scss”文件。
@import "icon/*.png";
@include all-icon-sprites;
其结果是一个错误:
- “语法错误:未定义的 mixin 'all-icon-sprites'。”
所以我将“_icons.scss”文件添加到我的项目中,并将代码更改为:
@import "icon/*.png";
@import "_icons";
@include all-icon-sprites;
现在,我收到此错误:
- 语法错误:“ $delete-position”后的无效CSS:预期“)”,是“:$ icon -删除-...”
- 位于 /path/to/_icons.scss 第 28 行
谁能向我解释我做错了什么?或者问题实际上出在“_icons.scss”文件上?
I'm fairly new to Compass, but I have been trying to use Compass in a project to generate my icon sprites. See this tutorial:
IMO, the tutorial isn't exactly clear. To start, the tutorial never tells you to create the "_icons.scss" file that contains the "all-icon-sprites" mixin.
@import "icon/*.png";
@include all-icon-sprites;
The result of this is an error:
- "Syntax error: Undefined mixin 'all-icon-sprites'."
So I added the "_icons.scss" file to my project, and changed the code to:
@import "icon/*.png";
@import "_icons";
@include all-icon-sprites;
Now, I get this error:
- Syntax error: Invalid CSS after " $delete-position": expected ")", was ": $icon-delete-..."
- on line 28 of /path/to/_icons.scss
Can anyone explain to me what I'm doing wrong? Or is the problem actually with the "_icons.scss" file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
本教程不会告诉您导入 _icons.scss,因为它不是必需的。您可以导入 png 文件或生成的文件 - 不能同时导入两者。它们是相同的,只是如果您导入 png 文件,您最终会导入生成的样式表,该样式表会随着 png 文件的更改(重命名、添加、删除等)自动保持最新。
老实说,如果处理样式表的指南针版本不是您在命令行上使用的版本,我希望看到此错误。您使用 Rails 还是 CLI 进行编译?
The tutorial doesn't tell you to import the _icons.scss, because it is not required. You either import the png files or the generated file -- not both. They are the same, except if you import the png files, you end up importing a generated stylesheet that is kept up to date automatically as the png files change (renames, added, removed, etc).
do you have any png files in the <images>/icon directory?
To be honest, this error is one I would expect to see if the compass version that is processing the stylesheet isn't the one you're using on the command line. Are you compiling with rails or the CLI?