Twitter bootstrap 定制bootstrap 3 sass

Twitter bootstrap 定制bootstrap 3 sass,twitter-bootstrap,sass,Twitter Bootstrap,Sass,我在定制bootstrap 3 sass时遇到问题_variables.scss是我的问题。我的设置如下: - scss -- bootstrap -- template bootstrap.scss template.scss Bootstrap.scss将创建默认的bootstap。Template.scss创建我需要的模板。问题是引导文件夹中的_variables.scs。当我在template/_variables.scss中设置$font size bas

我在定制bootstrap 3 sass时遇到问题_variables.scss是我的问题。我的设置如下:

- scss
  -- bootstrap
  -- template
     bootstrap.scss
     template.scss
Bootstrap.scss将创建默认的bootstap。Template.scss创建我需要的模板。问题是引导文件夹中的_variables.scs。当我在template/_variables.scss中设置$font size base时,它会被bootstrap/_variables中的_variables.scss覆盖

template.scss中包含以下内容:

import "template/my_variables.scss"
import "_bootstrap.scss" 
// to import bootstrap but I want to keep bootstrap separated from the template
... all other partials for this template
我可以通过删除bootstrap中的_variables.scs来解决这个问题。但我认为这样做不是个好主意。如果可能的话,我不想碰引导程序。不要砍核心

我也可以通过在template.scss中使bootstrap.scss成为一部分来解决这个问题。这是最好的解决方案,但是对于这个模板,我需要一个bootstrap.min.css和template.css


定制引导的最佳方式是什么

制作一个只包含导入的.scss文件怎么样。你可以称之为style.scss。您只需要在此文件中写入导入语句。例如:

@import "bootstrap/bootstrap";
@import "font-awesome/font-awesome";

@import "myVariables";
@import "myMixins";
@import "myTemplate"

@import "navbar";
@import "header";
@import "footer";

写入导入语句的顺序决定了哪些内容被覆盖。如果您在myVariables中设置一个变量,并在引导下导入myVariables,如示例所示,那么您的变量将覆盖引导变量。您还只需将这个文件style.scs编译成css。

这是可行的,但这是bootstrap 4解决方案。引导3中没有部分_Bootstrap.scs。