在我的style.sass问题中导入bootstrap变量

时间:2017-10-30 13:56:17

标签: twitter-bootstrap sass

我试图在我的style.sass中导入bootstrap 4 beta变量部分但是当我编译时我得到以下错误:

  

events.js:160         扔掉//未处理的'错误'事件         ^错误:node_modules \ bootstrap \ scss_variables.scss错误:$color的参数darken($color, $amount)必须是颜色

   Backtrace:
    node_modules/bootstrap/scss/_variables.scss:168, in function `darken`
    node_modules/bootstrap/scss/_variables.scss:168
    on line 168 of node_modules/bootstrap/scss/_variables.scss
     
    
      

$ link-hover-color:变暗($ link-color,15%)!default; ------------------------ ^

    
  
at options.error (C:\Users\Giannis\Desktop\np-lab\node_modules\node-sass\lib\index.js:291:26)

这是我的代码:

@import "../../../node_modules/bootstrap/scss/variables"

body
  background-color: red

任何想法是怎么回事? 感谢

1 个答案:

答案 0 :(得分:9)

在导入变量文件之前,您必须导入functions.scss。暗化函数在其中定义。

@import "../../../node_modules/bootstrap/scss/functions";
@import "../../../node_modules/bootstrap/scss/variables";
<!--your styles here-->