Skip to content

Commit f46813a

Browse files
committed
Merge pull request twbs#4763 from Luis-TP/2.1.1-wip
Improve .box-shadow mixin by utilizing regex function to no longer require escaping
2 parents 9d5f9ec + 2719ac3 commit f46813a

File tree

8 files changed

+19
-25
lines changed

8 files changed

+19
-25
lines changed

less/button-groups.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
.btn-group > .btn + .dropdown-toggle {
121121
padding-left: 8px;
122122
padding-right: 8px;
123-
.box-shadow(~"inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
123+
.box-shadow(inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05));
124124
*padding-top: 5px;
125125
*padding-bottom: 5px;
126126
}
@@ -147,7 +147,7 @@
147147
// Remove the gradient and set the same inset shadow as the :active state
148148
.dropdown-toggle {
149149
background-image: none;
150-
.box-shadow(~"inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)");
150+
.box-shadow(inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05));
151151
}
152152

153153
// Keep the hover's background when dropdown is open

less/buttons.less

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
border-bottom-color: darken(@btnBorder, 10%);
2525
.border-radius(4px);
2626
.ie7-restore-left-whitespace(); // Give IE7 some love
27-
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
27+
.box-shadow(inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05));
2828

2929
// Hover state
3030
&:hover {
@@ -51,7 +51,7 @@
5151
background-color: darken(@white, 15%) e("\9");
5252
background-image: none;
5353
outline: 0;
54-
.box-shadow(~"inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)");
54+
.box-shadow(inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05));
5555
}
5656

5757
// Disabled state

less/forms.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ input[type="color"],
126126
border-color: rgba(82,168,236,.8);
127127
outline: 0;
128128
outline: thin dotted \9; /* IE6-9 */
129-
.box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)");
129+
.box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6));
130130
}
131131
}
132132

less/mixins.less

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,7 @@
183183
.box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work
184184
&:focus {
185185
border-color: darken(@borderColor, 10%);
186-
// Write out in full since the lighten() function isn't easily escaped
187-
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@borderColor, 20%);
188-
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@borderColor, 20%);
189-
box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@borderColor, 20%);
186+
.box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@borderColor, 20%));
190187
}
191188
}
192189
// Give a small background color for input-prepend/-append
@@ -251,10 +248,11 @@
251248
}
252249

253250
// Drop shadows
254-
.box-shadow(@shadow) {
255-
-webkit-box-shadow: @shadow;
256-
-moz-box-shadow: @shadow;
257-
box-shadow: @shadow;
251+
.box-shadow(@shadowA, @shadowB:X, ...){
252+
@props: ~`"@{arguments}".replace(/[\[\]]|\,\sX/g, '')`;
253+
-webkit-box-shadow: @props;
254+
-moz-box-shadow: @props;
255+
box-shadow: @props;
258256
}
259257

260258
// Transitions

less/navbar.less

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@
202202
.navbar-fixed-top,
203203
.navbar-static-top {
204204
.navbar-inner {
205-
.box-shadow(~"inset 0 -1px 0 rgba(0,0,0,.1), 0 1px 10px rgba(0,0,0,.1)");
205+
.box-shadow(inset 0 -1px 0 rgba(0,0,0,.1), 0 1px 10px rgba(0,0,0,.1));
206206
}
207207
}
208208

209209
// Fixed to bottom
210210
.navbar-fixed-bottom {
211211
bottom: 0;
212212
.navbar-inner {
213-
.box-shadow(~"inset 0 1px 0 rgba(0,0,0,.1), 0 -1px 10px rgba(0,0,0,.1)");
213+
.box-shadow(inset 0 1px 0 rgba(0,0,0,.1), 0 -1px 10px rgba(0,0,0,.1));
214214
}
215215
}
216216

@@ -262,9 +262,7 @@
262262
color: @navbarLinkColorActive;
263263
text-decoration: none;
264264
background-color: @navbarLinkBackgroundActive;
265-
-webkit-box-shadow: inset 0 3px 8px rgba(0,0,0,.125);
266-
-moz-box-shadow: inset 0 3px 8px rgba(0,0,0,.125);
267-
box-shadow: inset 0 3px 8px rgba(0,0,0,.125);
265+
.box-shadow(inset 0 3px 8px rgba(0,0,0,.125));
268266
}
269267

270268
// Navbar button for toggling navbar items in responsive layouts
@@ -276,7 +274,7 @@
276274
margin-left: 5px;
277275
margin-right: 5px;
278276
.buttonBackground(darken(@navbarBackgroundHighlight, 5%), darken(@navbarBackground, 5%));
279-
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075)");
277+
.box-shadow(inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.075));
280278
}
281279
.navbar .btn-navbar .icon-bar {
282280
display: block;
@@ -448,7 +446,7 @@
448446
color: @white;
449447
background-color: @navbarInverseSearchBackground;
450448
border-color: @navbarInverseSearchBorder;
451-
.box-shadow(~"inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15)");
449+
.box-shadow(inset 0 1px 2px rgba(0,0,0,.1), 0 1px 0 rgba(255,255,255,.15));
452450
.transition(none);
453451
.placeholder(@navbarInverseSearchPlaceholderColor);
454452

less/progress-bars.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
.transition(width .6s ease);
6767
}
6868
.progress .bar + .bar {
69-
.box-shadow(~"inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15)");
69+
.box-shadow(inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15));
7070
}
7171

7272
// Striped bars

less/responsive-navbar.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
margin: (@baseLineHeight / 2) 0;
130130
border-top: 1px solid @navbarBackground;
131131
border-bottom: 1px solid @navbarBackground;
132-
.box-shadow(~"inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1)");
132+
.box-shadow(inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.1));
133133
}
134134
.navbar-inverse .nav-collapse .navbar-form,
135135
.navbar-inverse .nav-collapse .navbar-search {

less/scaffolding.less

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ a:hover {
4141
background-color: #fff;
4242
border: 1px solid #ccc;
4343
border: 1px solid rgba(0,0,0,.2);
44-
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,.1);
45-
-moz-box-shadow: 0 1px 3px rgba(0,0,0,.1);
46-
box-shadow: 0 1px 3px rgba(0,0,0,.1);
44+
.box-shadow(0 1px 3px rgba(0,0,0,.1));
4745
}
4846

4947
.img-circle {

0 commit comments

Comments
 (0)