【问题标题】:Error: argument `$color-2` of `mix($color-1, $color-2, $weight: 50%)` must be a color when compile my own bootstrap theme错误:编译我自己的引导主题时,`mix($color-1, $color-2, $weight: 50%)` 的参数 `$color-2` 必须是颜色
【发布时间】:2019-04-21 09:19:53
【问题描述】:

我尝试构建自己的主题。我将颜色主题更改为我的风格。但是我在编译自己的主题时出错,这是我创建的主题。

// 1. core variables and mixins
@import "../bootstrap/functions";
@import "../bootstrap/variables";
@import "../bootstrap/mixins";

// 2. custom core variables

// colors
$theme-colors : (
  "primary":    "46B078",
  "secondary":  "#B7E1CB",
  "success":    "#26de81",
  "info":       "#2bcbba",
  "warning":    "#fed330",
  "danger":     "#fc5c65",
);

// 3. core CSS
@import "../bootstrap/root";
@import "../bootstrap/reboot";
@import "../bootstrap/type";
@import "../bootstrap/images";
@import "../bootstrap/code";
@import "../bootstrap/grid";
@import "../bootstrap/tables";
@import "../bootstrap/forms";
@import "../bootstrap/buttons";
@import "../bootstrap/transitions";
@import "../bootstrap/dropdown";
@import "../bootstrap/button-group";
@import "../bootstrap/input-group";
@import "../bootstrap/custom-forms";
@import "../bootstrap/nav";
@import "../bootstrap/navbar";
@import "../bootstrap/card";
@import "../bootstrap/breadcrumb";
@import "../bootstrap/pagination";
@import "../bootstrap/badge";
@import "../bootstrap/jumbotron";
@import "../bootstrap/alert";
@import "../bootstrap/progress";
@import "../bootstrap/media";
@import "../bootstrap/list-group";
@import "../bootstrap/close";
@import "../bootstrap/modal";
@import "../bootstrap/tooltip";
@import "../bootstrap/popover";
@import "../bootstrap/carousel";
@import "../bootstrap/utilities";
@import "../bootstrap/print";

gulp 的错误信息:

Error in plugin "sass"
Message:
    src/sass/bootstrap/_functions.scss
Error: argument `$color-2` of `mix($color-1, $color-2, $weight: 50%)` must be a color
        on line 85 of src/sass/bootstrap/_functions.scss, in function `mix`
        from line 85 of src/sass/bootstrap/_functions.scss, in function `theme-color-level`
        from line 103 of src/sass/bootstrap/_tables.scss
        from line 25 of src/sass/themes/default.scss
>>   @return mix($color-base, $color, $level * $theme-color-interval);

   ----------^

如何解决这个错误,我的代码有什么问题。我按照引导文档中的说明进行操作,但仍然出错。

【问题讨论】:

  • 哎呀,我写错了颜色,不应该使用引号。 :)

标签: sass gulp bootstrap-4


【解决方案1】:

theme-colors 中的primary 颜色缺少颜色值前的# 符号。

正确的行应该是这样的:

"primary":    "#46B078",

【讨论】:

  • 是的,我忘记了标签符号,不应该使用引号
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-11-12
  • 2021-06-29
  • 2020-09-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-11
相关资源
最近更新 更多