Skip to content

Commit 9adb2ab

Browse files
committed
Simplify less functions
1 parent c87ba5c commit 9adb2ab

File tree

4 files changed

+11
-191
lines changed

4 files changed

+11
-191
lines changed

src/main/site/assets/less/functions.less

+1-180
Original file line numberDiff line numberDiff line change
@@ -5,132 +5,12 @@
55
More info at: http://lesselements.com
66
---------------------------------------------------
77
8-
- Gradient background
9-
- Drop shadow
10-
- Inner shadow
11-
- Rounded
12-
- Border radius
13-
- Opacity
148
- Transition
15-
- Transition duration
169
- Rotation
17-
- Scale
18-
- Translate
1910
- Box sizing
2011
2112
*/
2213

23-
/* - Gradient background
24-
*
25-
* First color is the background color to use for browsers
26-
* that don't support gradients. The second two colors are
27-
* the start and stop colors, going from bottom to top.
28-
*/
29-
30-
.gradient(@color: #F5F5F5, @start: #EEE, @stop: #FFF) {
31-
background: @color;
32-
background: -webkit-gradient(linear,
33-
left bottom,
34-
left top,
35-
color-stop(0, @start),
36-
color-stop(1, @stop));
37-
background: -ms-linear-gradient(bottom,
38-
@start,
39-
@stop);
40-
background: -moz-linear-gradient(center bottom,
41-
@start 0%,
42-
@stop 100%);
43-
background: -o-linear-gradient(@stop,
44-
@start);
45-
filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@stop,@start));
46-
}
47-
48-
/* - Drop shadow
49-
*
50-
* Adds a box-shadow that is a semi-transparent black. The
51-
* first two values control the x and y axis position, the
52-
* third controls blur (how big the shadow is), and the final
53-
* value is the opacity (0 is fully transparent, 1 is opaque).
54-
*/
55-
56-
.drop-shadow(@x-axis: 0, @y-axis: 1px, @blur: 2px, @alpha: 0.1) {
57-
-webkit-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
58-
-moz-box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
59-
box-shadow: @x-axis @y-axis @blur rgba(0, 0, 0, @alpha);
60-
}
61-
62-
/* - Inner shadow
63-
*
64-
* Sets the inner shadow. The first two numbers are the x and y
65-
* coordinates, the third is the blur and the last one is the
66-
* strength of the shadow.
67-
*/
68-
69-
.inner-shadow(@horizontal:0, @vertical:1px, @blur:2px, @alpha: 0.4) {
70-
-webkit-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
71-
-moz-box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
72-
box-shadow: inset @horizontal @vertical @blur rgba(0, 0, 0, @alpha);
73-
}
74-
75-
/* - Box shadow
76-
*/
77-
78-
.box-shadow(@arguments) {
79-
-webkit-box-shadow: @arguments;
80-
-moz-box-shadow: @arguments;
81-
box-shadow: @arguments;
82-
}
83-
84-
/* - Rounded
85-
*
86-
* Sets a border-radius for all 4 corners. If you want to set
87-
* border-radius for individual corners use: .border-radius
88-
*/
89-
90-
.rounded(@radius: 2px) {
91-
-webkit-border-radius: @radius;
92-
-moz-border-radius: @radius;
93-
border-radius: @radius;
94-
}
95-
96-
/* - Border radius
97-
*
98-
* Sets a border-radius for each of the 4 corners individually.
99-
* The values go in a clockwise rotation: top right, bottom right,
100-
* bottom left, top left.
101-
*/
102-
103-
.border-radius(@topright: 0, @bottomright: 0, @bottomleft: 0, @topleft: 0) {
104-
-webkit-border-top-right-radius: @topright;
105-
-webkit-border-bottom-right-radius: @bottomright;
106-
-webkit-border-bottom-left-radius: @bottomleft;
107-
-webkit-border-top-left-radius: @topleft;
108-
-moz-border-radius-topright: @topright;
109-
-moz-border-radius-bottomright: @bottomright;
110-
-moz-border-radius-bottomleft: @bottomleft;
111-
-moz-border-radius-topleft: @topleft;
112-
border-top-right-radius: @topright;
113-
border-bottom-right-radius: @bottomright;
114-
border-bottom-left-radius: @bottomleft;
115-
border-top-left-radius: @topleft;
116-
.background-clip(padding-box);
117-
}
118-
119-
/* - Opacity
120-
*
121-
* Sets the opacity. 0 is fully transparent, 1 is opaque.
122-
*/
123-
124-
.opacity(@opacity: 0.5) {
125-
-moz-opacity: @opacity;
126-
-khtml-opacity: @opacity;
127-
-webkit-opacity: @opacity;
128-
opacity: @opacity;
129-
@opperc: @opacity * 100;
130-
-ms-filter: ~"progid:DXImageTransform.Microsoft.Alpha(opacity=@{opperc})";
131-
filter: ~"alpha(opacity=@{opperc})";
132-
}
133-
13414
/* - Transition
13515
*
13616
* Sets the transition duration and effect to use for any
@@ -139,63 +19,16 @@
13919
*/
14020

14121
.transition(@duration:0.2s, @ease:ease-out) {
142-
-webkit-transition: all @duration @ease;
143-
-moz-transition: all @duration @ease;
144-
-o-transition: all @duration @ease;
14522
transition: all @duration @ease;
14623
}
14724

148-
/* - Transition duration
149-
*
150-
* Sets a transition-duration (time it takes to do things like
151-
* hover effects). The value provides a time in seconds.
152-
*/
153-
154-
.transition-duration(@duration: 0.2s) {
155-
-moz-transition-duration: @duration;
156-
-webkit-transition-duration: @duration;
157-
-o-transition-duration: @duration;
158-
transition-duration: @duration;
159-
}
160-
161-
/* - Transform
162-
*/
163-
164-
.transform(...) {
165-
-webkit-transform: @arguments;
166-
-moz-transform: @arguments;
167-
-o-transform: @arguments;
168-
-ms-transform: @arguments;
169-
transform: @arguments;
170-
}
171-
17225
/* - Rotation
17326
*
17427
* Rotates the item by a number of degrees clockwise.
17528
*/
17629

17730
.rotation(@deg:5deg){
178-
.transform(rotate(@deg));
179-
}
180-
/* - Scale
181-
*
182-
* Scales the item by the ratio provided. The example makes the
183-
* item 2 times larger.
184-
*/
185-
186-
.scale(@ratio:1.5){
187-
.transform(scale(@ratio));
188-
}
189-
190-
/* - Translate
191-
*
192-
* Translates an element using the given coordinates. The values
193-
* are x and y offset coordinates, so the above example moves the
194-
* element right 10 pixels and up 20 pixels.
195-
*/
196-
197-
.translate(@x:0, @y:0) {
198-
.transform(translate(@x, @y));
31+
transform: rotate(@deg);
19932
}
20033

20134
/* - Boox sizing
@@ -206,17 +39,5 @@
20639
*/
20740

20841
.box-sizing(@sizing: border-box) {
209-
-ms-box-sizing: @sizing;
210-
-moz-box-sizing: @sizing;
211-
-webkit-box-sizing: @sizing;
21242
box-sizing: @sizing;
21343
}
214-
215-
/* - Background clip
216-
*/
217-
218-
.background-clip(@argument: padding-box) {
219-
-moz-background-clip: @argument;
220-
-webkit-background-clip: @argument;
221-
background-clip: @argument;
222-
}

src/main/site/assets/less/layout.less

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ h1 {
8383
left: -18px;
8484
bottom: -20px;
8585

86-
.rounded(10px);
86+
border-radius: 10px;
8787
}
8888

8989
a {
@@ -113,7 +113,7 @@ h2 {
113113
left: -18px;
114114
bottom: -11px;
115115

116-
.rounded(10px);
116+
border-radius: 10px;
117117
}
118118
}
119119

src/main/site/assets/less/style.less

+8-8
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
left: 5px;
120120

121121
.transition();
122-
.opacity(0);
122+
opacity: 0;
123123
}
124124

125125
span {
@@ -159,7 +159,7 @@
159159
font-size: 14px;
160160
font-size: 1.4rem;
161161

162-
.rounded(8px);
162+
border-radius: 8px;
163163
.transition();
164164

165165
&:hover {
@@ -224,7 +224,7 @@
224224
}
225225

226226
.logo a::after {
227-
.opacity(1);
227+
opacity: 1;
228228
}
229229

230230
.sep::after {
@@ -428,14 +428,14 @@ nav#nav-mobile {
428428
right: 0;
429429
z-index: 10000;
430430

431-
.border-radius(0, 0, 5px, 0);
431+
border-bottom-left-radius: 5px;
432432

433433
input {
434434
display: none;
435435
border: 0;
436436
padding: 2px 4px;
437437

438-
.border-radius(0, 0, 3px, 0);
438+
border-bottom-left-radius: 3px;
439439

440440
@media (@mobile) {
441441
display: inline-block;
@@ -570,7 +570,7 @@ nav#nav-mobile {
570570
top: 8px;
571571
left: 0;
572572

573-
.rounded(2px)
573+
border-radius: 2px;
574574
}
575575

576576
&::before {
@@ -680,7 +680,7 @@ nav#nav-mobile {
680680
border: 2px solid #000;
681681
margin-bottom: 8px;
682682

683-
.rounded(100%);
683+
border-radius: 100%;
684684
.transition();
685685

686686
&.active {
@@ -710,7 +710,7 @@ nav#nav-mobile {
710710
opacity: 1;
711711
visibility: visible;
712712

713-
.translate(10px);
713+
transform: translateX(10px);
714714
}
715715
}
716716

0 commit comments

Comments
 (0)