Sass::SyntaxError: 未定义的 mixin 'mixin_name' [英] Sass::SyntaxError: Undefined mixin 'mixin_name'
问题描述
我正在开发一个 Rails 4 项目,我使用 Sass 和 Sass 的 @import 将多个 css 合并为一个.它工作正常,但如果我对 mixins (_mixins.css.scss
) 使用新的部分,并且仅在 main.css.scss
中使用 @import 并使用 mixins 任何其他在 _webapp.css.scss
I'm working on a Rails 4 project where I'm using Sass and Sass's @import to combine multiple css into one. It works fine but not if I use a new partial for mixins (_mixins.css.scss
) and @import this in main.css.scss
only and use mixins any other file which is added after that _webapp.css.scss
@import "bootstrap/bootstrap";
@import "responsive/mega_menu";
@import "responsive/mixins";
@import "responsive/webapp";
Rails 预编译过程无法找到responsive/mixins
"并在 _webapp.css.scss
Rails Precompilation process is unable to find "responsive/mixins
" and gives error in _webapp.css.scss
Sass::SyntaxError: Undefined mixin 'mixin_name'.
这里 mixin_name
定义在 responsive/mixins
推荐答案
如果你的文件名为mixins.css.scss
,那么你只有在名为mixins的时候才能导入.css
,因为 SASS 试图解释 @import 语句.如果没有扩展名,SASS 期望它是 [filename].scss
.您正在尝试导入 [filename].scss
而您的名字是 [filename].css.scss
.所以试试:
If your file is named mixins.css.scss
, then you can only import it when it is called as mixins.css
, since SASS tries to interpret the @import statement. If there is no extension, SASS expects it to be [filename].scss
. You are trying to import [filename].scss
while your name is [filename].css.scss
. So try:
@import "responsive/mixins.css";
这篇关于Sass::SyntaxError: 未定义的 mixin 'mixin_name'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!