如何使用Bower保持Twitter Bootstrap自定义? [英] How to keep Twitter Bootstrap customization with Bower?
问题描述
我正在使用 yeoman 的项目,其中包括咕用于自动化, bower 用于客户端软件包管理。我项目的依赖项之一是 SASS twitter-bootstrap 。
I'm working in a project with yeoman which includes grunt for automation and bower for client-side package management. One of the dependencies of my project is SASS twitter-bootstrap.
在我手动管理依赖项更新的其他项目中,我更改了 Bootstrap 值直接在Bootstrap variables.less
( _variables.scss
)文件中并在中进行扩展项目自己的
文件。我在这里做了同样的事情,但是当我用Bower安装其他软件包时,它覆盖了所有内容(感谢上帝,我 un..gitignored我的组件文件夹) css
文件夹下的main.less
In other projects, in which I manually managed the updates of dependencies, I changed Bootstrap values directly in the Bootstrap variables.less
(_variables.scss
) file and extend it in main.less
files under the project own css
folder. I did the same here, but when I installed other packages with Bower it overrode everything (I "un-.gitignored" my components' folder, thanks God)
什么是最好的方法在组件文件夹的外部自定义 Bootstrap ,这样就不会再次发生?
What's the best way to customize Bootstrap outside the components' folder so it won't happen again?
推荐答案
永远不要修改 bower_components
文件夹的内容。我们将确保更加清楚。
You should never modify the contents of the bower_components
folder. We'll make sure to make that clearer.
关于您的问题。将 _variables.scss
文件从 bower_components
文件夹复制到例如。 app / styles
,然后将其导入到您的 main.scss
或任何名称的引导程序导入语句上方。这将导致您的自定义文件覆盖默认变量。
As for your question. Copy the _variables.scss
file from the bower_components
folder to eg. app/styles
, then import it into your main.scss
, or whatever it's named, above the import statement for bootstrap. This will result in your custom file overriding the default variables.
这篇关于如何使用Bower保持Twitter Bootstrap自定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!