我正在使用 Bower 来管理 Bootstrap,并希望对默认的 Bootstrap 外观进行一些更改(颜色、字体大小等)。这是我的工作流程:
- 编辑
bower_components/bootstrap/less/variables.less
- 使用
grunt build
重新编译 Bootstrap
问题是我希望能够在新版本发布时升级 bootstrap,并且可能会丢失对 variables.less
的更改。
有没有一种方法可以将我的更改保留在 bower_components
之外,同时避免在源代码管理中使用 bower_components
,因为它有 122MB?
最佳答案
您可以创建一个 variables-custom.less
并将其导入到 theme.less
中,如下所示:
//
// Load core variables and mixins
// --------------------------------------------------
@import "variables.less";
//import custom-variables after variables so the values will override.
@import "custom-variables.less"; //only has variables that have changed.
@import "mixins.less";
IMO 这比第一个解决方案好一点,因为您不必在客户端加载两个(几乎)相同的 CSS 文件。
很抱歉,我无法帮助您了解 Bower 和您的源代码管理,因为我不使用 Bower
关于css - 如何在不丢失更改的情况下自定义 Bootstrap?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24769963/