Node & Gulp for SASS - 堆栈级别太深



尝试使用 Gulp 将我的 SASS 编译成.css文件曾经使用指南针,并想改用Gulp。 下面的这个混合不是我创建的,而是正在使用的。 标头的一个文件确实使用了 mixin bp(执行断点)

此外,这些问题有时会发生,有时在从 Gulp 运行 sass 编译时不会发生。 并不总是复制相同的确切斑点。 我还删除了css文件,并用此错误重新编译。 css 仍然存在并且似乎可以工作。 我该怎么办? 思潮?

插件"sass"中的错误

消息: afa/scss/layout/_header-search.scss

系统堆栈错误:堆栈级别太深

              on line 41 of afa/scss/layout/_header-search.scss

---> @include bp(最小宽度, $bp-中等 + 1) { ---------^

下面是文件本身的 Mixin

// =============================================
// Mixin - Breakpoint
// =============================================
$mq-support: true !default;
$mq-fixed-value: 1024px !default;
@mixin bp($feature, $value) {
    // Set global device param
    $media: only screen;
    // Media queries supported
    @if $mq-support == true {
        @media #{$media} and ($feature: $value) {
            @content;
        }
        // Media queries not supported
    } @else {
        @if $feature == 'min-width' {
            @if $value <= $mq-fixed-value {
                @content;
            }
        } @else if $feature == 'max-width' {
            @if $value >= $mq-fixed-value {
                @content;
            }
        }
    }
}
/*
// ----------------------------------------------
// Usage example:
// For IE set $mq-support to false.
// Set the fixed value.
// Then use mixins to test whether styles should be applied.
// ----------------------------------------------
$mq-support: false;
$mq-fixed-value: 1024;
// Renders at fixed value
@include bp (min-width, 300px) { 
    div { color:#000; }
}
// Doesn't render without MQ support
@include bp (min-width, 1200px) { 
    div { color:#FFF; }
}
// Doesn't render without MQ support
@include bp (max-width, 300px) { 
    div { color:#444; }
}
// Renders at fixed value
@include bp (max-width, 1200px) { 
    div { color:#888; }
}
// ----------------------------------------------
*/

这是来自 _header-search.scss 文件的调用

@include bp(min-width, $bp-medium + 1) {
    .skip-search {
        display: none;
    }
}

事实证明,此错误是由sass-gulp包的过时版本引起的。如果其他人遇到此问题,请尝试更新到版本 3.1.0 或更高版本。