SASS编译顺序:在某些代码中分配给未编译变量的函数输出

SASS编译顺序:在某些代码中分配给未编译变量的函数输出,sass,bourbon,Sass,Bourbon,我用的是波旁威士忌和沙士口味的引导法。这是我的基本SCSS文件: @import '../../bower_components/bourbon/dist/_bourbon.scss'; @import 'app/swatches.scss'; @import '../../bower_components/bootstrap-sass/lib/bootstrap.scss'; @import 'app/theme.scss'; 我的想法是,我首先使用Bourbon,因为我打算在所有地方使用它

我用的是波旁威士忌和沙士口味的引导法。这是我的基本SCSS文件:

@import '../../bower_components/bourbon/dist/_bourbon.scss';
@import 'app/swatches.scss';
@import '../../bower_components/bootstrap-sass/lib/bootstrap.scss';
@import 'app/theme.scss';
我的想法是,我首先使用Bourbon,因为我打算在所有地方使用它,调用
swatches.scss
来设置应用程序范围内的变量,调用Bootstrap(使用一些样本),然后在Bootstrap之上定制我的应用程序<代码>样例.scss如下所示:

// The brand
$blue          : #0078ae;
$grey-light    : #58595b;
$grey-dark     : #59595e;
$gradient-blue : linear-gradient( #0089ca, #006cb9 );
$gradient-grey : linear-gradient( #e1e2e2 0, #d8d9da 33%, #cecece 33.001%, #b8b8b8 100% );

// Set Bootstrap's variables (map back to our own vars if need be)
$brand-primary            : $blue;
$btn-default-color        : #fff;
$panel-primary-heading-bg : $gradient-blue;
$panel-default-heading-bg : $gradient-grey;

%gradient-blue {
    @include background-image( $gradient-blue );
}
不知何故,Bootstrap没有收到编译后的
$gradient blue
——它收到未编译的字符串
线性渐变(#0089ca,#006cb9)
theme.scss中的代码调用$gradient blue(或扩展名%gradient blue)没有问题


我希望
$gradient blue
只编译一次就可以完成。这是怎么发生的?

我认为你应该在语法中使用线性渐变:

$gradient-blue : @include linear-gradient( #0089ca, #006cb9 );
$gradient-grey : @include linear-gradient( #e1e2e2 0, #d8d9da 33%, #cecece 33.001%, #b8b8b8 100% );
因为这是一场混战。查看文档:

它也是可用的,这就是我在这里使用它的方式。神秘之处在于它为什么在某些地方工作而在其他地方不工作:如果它真的工作,我希望是因为函数已经执行并将其计算值返回给它指定的变量。但是,当它在引导中被调用时,函数不会被编译。奇怪的