[英]What is the most efficient way to override Bootstrap css?
I'm using Opencart for a E-Commerce site for my company. 我使用Opencart的一个电子商务网站为我的公司。 The Opencart developer is working on V2.0 which will incorporate Bootstrap as the default styling.
Opencart开发人员正在开发V2.0,它将把Bootstrap作为默认样式。
My plan was to put a link in my header file on the next line BELOW the link to bootstrap stylesheet example: 我的计划是在链接到引导程序样式表示例的下一行的下一行中的头文件中放置一个链接:
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="catalog/view/theme/default/stylesheet/override.css" />
I was planning on using LESS to compile into override.css and only change small parts of the Bootstrap less to meet my needs. 我打算用LESS编译成override.css,只改变引导少的一小部分,以满足我的需求。 For example, I was planning on only including the variables.less from bootstrap along with buttons.less and layout.less.
例如,我打算只包括bootstrap中的variables.less以及button.less和layout.less。 I'd then compile those modified files into override.css to get my personalized styles.
然后我编译那些修改过的文件到override.css让我的个性化风格。 However, the more I think about it, I realize I'd need to include all the LESS from Bootstrap.
但是,我考虑得越多,我意识到我需要包括Bootstrap中的所有LESS。 This would make my override.css essentially the same as bootstrap.css (with the exception of the changes I make for my styling).
这将使我override.css基本相同,bootstrap.css(有变化我为我的造型除外)。
This essentially defeats the purpose of having an override. 这实际上违反了建立覆盖的目的。 Is there a way to not need to include ALL the bootstrap less, just the parts that I want in the override?
有没有一种方法不需要只包括所有我需要的引导程序,而不必覆盖我想要的部分?
People may be wondering why I don't just modify the bootstrap.css file. 人们也许会奇怪,为什么我不只是修改bootstrap.css文件。 My thought is that if I do modify the bootstrap.css file all my changes will be overwritten if I go to upgrade (or if the Opencart developer upgrades) bootstrap in the future.
我的想法是,如果我修改bootstrap.css文件,如果我将来升级(或者如果Opencart开发人员升级)bootstrap,我的所有更改都将被覆盖。
Any advise is much appreciated! 任何建议深表感谢!
Thanks! 谢谢!
DS-MATT DS-MATT
Why don't you keep an overwrite.css
to yourself, while presenting compiled bootstrap.css
+ override.css
to the end user? 为什么在向最终用户展示已编译的
bootstrap.css
+ override.css
,不保留自己的overwrite.css
? That way you can easily update your bootstrap.css
in the future and easily maintain the overrides themselves. 这样,您将来就可以轻松更新
bootstrap.css
并轻松维护覆盖本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.