将引导程序(甚至从另一个 less,css 文件)类集成到我的 less 文件中的更智能方法?(继承) [英] A smarter way for integrating bootstrap(or even from another less,css file) classes into my less file ?(Inheritance)
问题描述
我正在寻找一种更智能的方法将引导类集成到我的 less 文件中?
I am looking for a smarter way for integrating bootstrap classes into my less file ?
我目前所做的是,但这有一个缺点,即并非每个子类"或连接的类都会为我自己的控件继承:
What I do at the moment is ,but this has the drawback that not every "subclass" or connected class is going to be inherit for my own control:
.BWForm_form-control {
.form-control;
}
我解决了这个问题(连接的类)我从引导程序中获取类并将其调整为我的控制:
I solved that issue( connected classes) I took the classes from bootstrap and adjust it to my control:
/*#region ".BWForm_form-control" addition from bootstrap */
.BWForm_form-control:-moz-placeholder {
color: #999999;
}
.BWForm_form-control::-moz-placeholder {
color: #999999;
}
.BWForm_form-control:-ms-input-placeholder {
color: #999999;
}
.BWForm_form-control::-webkit-input-placeholder {
color: #999999;
}
.BWForm_form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}
.BWForm_form-control[disabled],
.BWForm_form-control[readonly],
fieldset[disabled] .BWForm_form-control {
cursor: not-allowed;
background-color: #eeeeee;
}
textarea.BWForm_form-control {
height: auto;
}
.has-warning .BWForm_form-control {
border-color: #c09853;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-warning .BWForm_form-control:focus {
border-color: #a47e3c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;
}
.has-error .BWForm_form-control {
border-color: #b94a48;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-error .BWForm_form-control:focus {
border-color: #953b39;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;
}
.has-success .BWForm_form-control {
border-color: #468847;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-success .BWForm_form-control:focus {
border-color: #356635;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;
}
@media (min-width: 768px) {
.form-inline .BWForm_form-control {
display: inline-block;
}
}
.input-group .BWForm_form-control {
width: 100%;
margin-bottom: 0;
}
.input-group-lg > .BWForm_form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn {
height: 45px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.33;
border-radius: 6px;
}
select.input-group-lg > .form-control,
select.input-group-lg > .input-group-addon,
select.input-group-lg > .input-group-btn > .btn {
height: 45px;
line-height: 45px;
}
textarea.input-group-lg > .BWForm_form-control,
textarea.input-group-lg > .input-group-addon,
textarea.input-group-lg > .input-group-btn > .btn {
height: auto;
}
.input-group-sm > .BWForm_form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .btn {
height: 30px;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
select.input-group-sm > .BWForm_form-control,
select.input-group-sm > .input-group-addon,
select.input-group-sm > .input-group-btn > .btn {
height: 30px;
line-height: 30px;
}
textarea.input-group-sm > .BWForm_form-control,
textarea.input-group-sm > .input-group-addon,
textarea.input-group-sm > .input-group-btn > .btn {
height: auto;
}
.input-group-addon,
.input-group-btn,
.input-group .BWForm_form-control {
display: table-cell;
}
.input-group-addon:not(:first-child):not(:last-child),
.input-group-btn:not(:first-child):not(:last-child),
.input-group .BWForm_form-control:not(:first-child):not(:last-child) {
border-radius: 0;
}
.input-group .BWForm_form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-group .BWForm_form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child) {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
@media (min-width: 768px) {
.navbar-form .BWForm_form-control {
display: inline-block;
}
}
/*#endregion */
为了保证我的个人控件的引导程序的全部功能.但我确信这不是一个聪明、稳定的解决方案,它只是一个修复和临时解决方案.
To guarantee the full functionality of bootstrap for my personal controls. But I am sure that is not a clever, stable soultion it's just a fix and temporary solution.
但是,创建从引导程序(甚至从另一个 css/less 文件)继承的具有所有功能的个人控件的最佳方法是什么?
But what is the best approach to create personal controls inherited from bootstrap(or even from another css/less file) whith all the functionality ?
我的项目的一些背景信息:重要的 NuGet 包:
Some Background informations for my project: Important NuGet Pakages:
- Bootstrap (v 3.0.0) -> 在母版页中导入
- Bootstrap.Less (v 2.3.2) ->我用于导入的这些文件"Site.less")
- 无点 (v 1.4.0.0)
- html5shiv (v 0.1.0.8)
- Modernizr (v 2.6.2) -> 在母版页中导入
- 响应 JS (v 1.2.0)
实际上我没有使用这个Bootstrap.Less (v 2.3.2)"-nuget 包,我只是把我的 bootstrap.css 重命名为 bootstrap.less",并用它从那个新的 less 文件继承.
Actually I am not using this "Bootstrap.Less (v 2.3.2 )"-nuget package, i just took my bootstrap.css and renamed it to bootstrap.less" and used it to inherit from that new less-file.
因为我还有一些问题:
Visual Studio 2013
Visual Studio 2013
- MVC5
最好的问候马丁
推荐答案
您可以使用 扩展:
.BWForm_form-control:extend(.form-control all);
这篇关于将引导程序(甚至从另一个 less,css 文件)类集成到我的 less 文件中的更智能方法?(继承)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!