Skip to content

Commit

Permalink
separate mixins by context
Browse files Browse the repository at this point in the history
many files, but good to maintain.
  • Loading branch information
samuelmesq committed Oct 10, 2012
1 parent e27adb5 commit 446f001
Show file tree
Hide file tree
Showing 14 changed files with 176 additions and 120 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#more.less is a collection of lesscss mixins
#more.less is a collection of [Less](http://lesscss.org) mixins
> Less is more.
examples:

* boxShadow();
* simpleGradient();
* verticalGradient();
* borderRadius();
* opacity();
7 changes: 7 additions & 0 deletions css3/border-radius.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* Border Radius
============================*/
.borderRadius(@radius: 2px){
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}
5 changes: 5 additions & 0 deletions css3/box-shadow.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.boxShadow(@color: rgba(0, 0, 0, .1), @params: 0 1px 1px) {
-webkit-box-shadow: @params @color;
-moz-box-shadow: @params @color;
box-shadow: @params @color;
}
5 changes: 5 additions & 0 deletions css3/box-sizing.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.boxSizing(@param: border-box){
-webkit-box-sizing: @param; /* Safari/Chrome, other WebKit */
-moz-box-sizing: @param; /* Firefox, other Gecko */
box-sizing: @param; /* Opera/IE 8+ */
}
8 changes: 8 additions & 0 deletions css3/filter.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.filter(@filter){
filter: @filter;
// Browser Specific
-webkit-filter: @filter;
-moz-filter: @filter;
-o-filter: @filter;
-ms-filter: @filter;
}
5 changes: 5 additions & 0 deletions css3/transition.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.transition(@duration:0.2s, @ease:ease-out, @target: all) {
-webkit-transition: @target @duration @ease;
-moz-transition: @target @duration @ease;
transition: @target @duration @ease;
}
43 changes: 43 additions & 0 deletions gradient/horizontal-gradient.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* Horizontal Gradient
============================*/
.horizontalGradient(@start, @stop){
background: @start; // Old browsers
background: -moz-linear-gradient(left, @start 0%, @stop 100%); // FF3.6+
background: -webkit-gradient(linear, left top, right top, color-stop(0%,@start), color-stop(100%,@stop)); // Chrome,Safari4+
background: -webkit-linear-gradient(left, @start 0%,@stop 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(left, @start 0%,@stop 100%); // Opera 11.10+
background: -ms-linear-gradient(left, @start 0%,@stop 100%); // IE10+
background: linear-gradient(left, @start 0%,@stop 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{stop}'), GradientType=1"; // IE6-8
}
.horizontalGradient(@start, @stop, @end){
background: @start; // Old browsers
background: -moz-linear-gradient(left, @start 0%, @stop 50%, @end 100%); // FF3.6+
background: -webkit-gradient(linear, left top, right top, color-stop(0%,@start), color-stop(50%, @stop), color-stop(100%,@end)); // Chrome,Safari4+
background: -webkit-linear-gradient(left, @start 0%,@stop 50%, @end 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(left, @start 0%,@stop 50%, @end 100%); // Opera 11.10+
background: -ms-linear-gradient(left, @start 0%,@stop 50%, @end 100%); // IE10+
background: linear-gradient(left, @start 0%,@stop 50%, @end 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}', GradientType=1)"; // IE6-8
}
.horizontalGradient(@start, @stop, @stop2, @end){
background: @start; // Old browsers
background: -moz-linear-gradient(left, @start 0%, @stop 35%, @stop2 65%, @end 100%); // FF3.6+
background: -webkit-gradient(linear, left top, right top, color-stop(0%,@start), color-stop(35%, @stop), color-stop(65%, @stop2), color-stop(100%,@end)); // Chrome,Safari4+
background: -webkit-linear-gradient(left, @start 0%,@stop 35%, @stop2 65%, @end 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(left, @start 0%,@stop 35%, @stop2 65%, @end 100%); // Opera 11.10+
background: -ms-linear-gradient(left, @start 0%,@stop 35%, @stop2 65%, @end 100%); // IE10+
background: linear-gradient(left, @start 0%,@stop 35%, @stop2 65%, @end 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}', GradientType=1)"; // IE6-8
}

.horizontalGradient(center, @start, @stop, @stop2, @end){
background: @start; // Old browsers
background: -moz-linear-gradient(left, @start 0%, @stop 50%, @stop2 0%, @end 100%); // FF3.6+
background: -webkit-gradient(linear, left top, right top, color-stop(0%,@start), color-stop(50%, @stop), color-stop(0%, @stop2), color-stop(100%,@end)); // Chrome,Safari4+
background: -webkit-linear-gradient(left, @start 0%,@stop 50%, @stop2 0%, @end 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(left, @start 0%,@stop 50%, @stop2 0%, @end 100%); // Opera 11.10+
background: -ms-linear-gradient(left, @start 0%,@stop 50%, @stop2 0%, @end 100%); // IE10+
background: linear-gradient(left, @start 0%,@stop 50%, @stop2 0%, @end 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}', GradientType=1)"; // IE6-8
}
42 changes: 42 additions & 0 deletions gradient/vertical-gradient.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* Vertical Gradient
============================*/
.verticalGradient(@start, @stop){
background: @start; // Old browsers
background: -moz-linear-gradient(top, @start 0%, @stop 100%); // FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(100%,@stop)); // Chrome,Safari4+
background: -webkit-linear-gradient(top, @start 0%,@stop 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(top, @start 0%,@stop 100%); // Opera 11.10+
background: -ms-linear-gradient(top, @start 0%,@stop 100%); // IE10+
background: linear-gradient(top, @start 0%,@stop 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{stop}')"; // IE6-8
}
.verticalGradient(@start, @stop, @end){
background: @start; // Old browsers
background: -moz-linear-gradient(top, @start 0%, @stop 50%, @end 100%); // FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(50%, @stop), color-stop(100%,@end)); // Chrome,Safari4+
background: -webkit-linear-gradient(top, @start 0%,@stop 50%, @end 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(top, @start 0%,@stop 50%, @end 100%); // Opera 11.10+
background: -ms-linear-gradient(top, @start 0%,@stop 50%, @end 100%); // IE10+
background: linear-gradient(top, @start 0%,@stop 50%, @end 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}')"; // IE6-8
}
.verticalGradient(@start, @stop, @stop2, @end){
background: @start; // Old browsers
background: -moz-linear-gradient(top, @start 0%, @stop 35%, @stop2 65%, @end 100%); // FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(35%, @stop), color-stop(65%, @stop2), color-stop(100%,@end)); // Chrome,Safari4+
background: -webkit-linear-gradient(top, @start 0%,@stop 35%, @stop2 65%, @end 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(top, @start 0%,@stop 35%, @stop2 65%, @end 100%); // Opera 11.10+
background: -ms-linear-gradient(top, @start 0%,@stop 35%, @stop2 65%, @end 100%); // IE10+
background: linear-gradient(top, @start 0%,@stop 35%, @stop2 65%, @end 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}')"; // IE6-8
}
.verticalGradient(center, @start, @stop, @stop2, @end){
background: @start; // Old browsers
background: -moz-linear-gradient(top, @start 0%, @stop 50%, @stop2 0%, @end 100%); // FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(50%, @stop), color-stop(0%, @stop2), color-stop(100%,@end)); // Chrome,Safari4+
background: -webkit-linear-gradient(top, @start 0%,@stop 50%, @stop2 0%, @end 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(top, @start 0%,@stop 50%, @stop2 0%, @end 100%); // Opera 11.10+
background: -ms-linear-gradient(top, @start 0%,@stop 50%, @stop2 0%, @end 100%); // IE10+
background: linear-gradient(top, @start 0%,@stop 50%, @stop2 0%, @end 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}')"; // IE6-8
}
19 changes: 19 additions & 0 deletions helper/clearfix.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Clearfix
// --------
// For clearing floats like a boss h5bp.com/q
.clearfix {
*zoom: 1;
&:before,
&:after {
display: table;
content: "";
}
&:after {
clear: both;
}
}

// shortcut
.cfx{
.clearfix();
}
4 changes: 4 additions & 0 deletions helper/indent.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.indent() {
text-align: left;
text-indent: -999em;
}
5 changes: 5 additions & 0 deletions helper/opacity.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.opacity(@alpha: 0.5) {
opacity: @alpha;
@ie: percentage(@alpha);
filter:~"alpha(opacity=@{ie})";
}
136 changes: 18 additions & 118 deletions more.less
Original file line number Diff line number Diff line change
@@ -1,122 +1,22 @@
// Clearfix
// --------
// For clearing floats like a boss h5bp.com/q
.clearfix {
*zoom: 1;
&:before,
&:after {
display: table;
content: "";
}
&:after {
clear: both;
}
}

/* ====================================
= All properties of gradients mixins is from Colorzilla
= http://www.colorzilla.com/gradient-editor/
==================================== */

.simpleGradient(@start: #f3f3f3, @stop: #666666, @svg: ' '){
background: @start; // Old browsers
background-image: ~"url(data:image/svg+xml;base64,@{svg})"; // IE9 SVG, needs conditional override of 'filter' to 'none'
background: -moz-linear-gradient(top, @start 0%, @stop 100%); // FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(100%,@stop)); // Chrome,Safari4+
background: -webkit-linear-gradient(top, @start 0%,@stop 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(top, @start 0%,@stop 100%); // Opera 11.10+
background: -ms-linear-gradient(top, @start 0%,@stop 100%); // IE10+
background: linear-gradient(top, @start 0%,@stop 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{stop}')"; // IE6-8
}

.verticalGradient(@start, @stop){
background: @start; // Old browsers
background: -moz-linear-gradient(top, @start 0%, @stop 100%); // FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(100%,@stop)); // Chrome,Safari4+
background: -webkit-linear-gradient(top, @start 0%,@stop 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(top, @start 0%,@stop 100%); // Opera 11.10+
background: -ms-linear-gradient(top, @start 0%,@stop 100%); // IE10+
background: linear-gradient(top, @start 0%,@stop 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{stop}')"; // IE6-8
}
.verticalGradient(@start, @stop, @end){
background: @start; // Old browsers
background: -moz-linear-gradient(top, @start 0%, @stop 50%, @end 100%); // FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(50%, @stop), color-stop(100%,@end)); // Chrome,Safari4+
background: -webkit-linear-gradient(top, @start 0%,@stop 50%, @end 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(top, @start 0%,@stop 50%, @end 100%); // Opera 11.10+
background: -ms-linear-gradient(top, @start 0%,@stop 50%, @end 100%); // IE10+
background: linear-gradient(top, @start 0%,@stop 50%, @end 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}')"; // IE6-8
}
.verticalGradient(center, @start, @stop, @stop2, @end){
background: @start; // Old browsers
background: -moz-linear-gradient(top, @start 0%, @stop 50%, @stop2 0%, @end 100%); // FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(50%, @stop), color-stop(0%, @stop2), color-stop(100%,@end)); // Chrome,Safari4+
background: -webkit-linear-gradient(top, @start 0%,@stop 50%, @stop2 0%, @end 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(top, @start 0%,@stop 50%, @stop2 0%, @end 100%); // Opera 11.10+
background: -ms-linear-gradient(top, @start 0%,@stop 50%, @stop2 0%, @end 100%); // IE10+
background: linear-gradient(top, @start 0%,@stop 50%, @stop2 0%, @end 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}')"; // IE6-8
}
.verticalGradient(normal, @start, @stop, @stop2, @end){
background: @start; // Old browsers
background: -moz-linear-gradient(top, @start 0%, @stop 35%, @stop2 65%, @end 100%); // FF3.6+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,@start), color-stop(35%, @stop), color-stop(65%, @stop2), color-stop(100%,@end)); // Chrome,Safari4+
background: -webkit-linear-gradient(top, @start 0%,@stop 35%, @stop2 65%, @end 100%); // Chrome10+,Safari5.1+
background: -o-linear-gradient(top, @start 0%,@stop 35%, @stop2 65%, @end 100%); // Opera 11.10+
background: -ms-linear-gradient(top, @start 0%,@stop 35%, @stop2 65%, @end 100%); // IE10+
background: linear-gradient(top, @start 0%,@stop 35%, @stop2 65%, @end 100%); // W3C
filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr='@{start}', endColorstr='@{end}')"; // IE6-8
}

.borderRadius(@radius: 2px){
-webkit-border-radius: @radius;
-moz-border-radius: @radius;
border-radius: @radius;
}

.boxShadow(@color: rgba(0, 0, 0, .1), @params: 0 1px 1px) {
-webkit-box-shadow: @params @color;
-moz-box-shadow: @params @color;
box-shadow: @params @color;
}

.transition(@duration:0.2s, @ease:ease-out, @target: all) {
-webkit-transition: @target @duration @ease;
-moz-transition: @target @duration @ease;
transition: @target @duration @ease;
}

.translate(@x: 0, @y: 0){
-webkit-transform: translate( @x , @y );
-moz-transform: translate( @x , @y );
-o-transform: translate( @x , @y );
-ms-transform: translate( @x , @y );
transform: translate( @x , @y );
}

.scale(@ratio:1.1){
-webkit-transform:scale(@ratio);
-moz-transform:scale(@ratio);
-ms-transform: scale (@ratio);
transform:scale(@ratio);
}

.boxSizing(@param: border-box){
-webkit-box-sizing: @param; /* Safari/Chrome, other WebKit */
-moz-box-sizing: @param; /* Firefox, other Gecko */
box-sizing: @param; /* Opera/IE 8+ */
}

.indent() {
text-align: left;
text-indent: -999em;
}

.opacity(@alpha: 0.5) {
opacity: @alpha;
@ie: percentage(@alpha);
filter:~"alpha(opacity=@{ie})";
}
@import "gradient/vertical-gradient";
@import "gradient/horizontal-gradient";

// Helpers
@import "helper/clearfix";
@import "helper/indent";
@import "helper/opacity";

// CSS3
@import "css3/border-radius";
@import "css3/box-shadow";
@import "css3/transition";
@import "css3/filter";
@import "css3/box-sizing";

// Transform
@import "transform/scale";
@import "transform/translate";
6 changes: 6 additions & 0 deletions transform/scale.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.scale(@ratio:1.1){
-webkit-transform:scale(@ratio);
-moz-transform:scale(@ratio);
-ms-transform: scale (@ratio);
transform:scale(@ratio);
}
7 changes: 7 additions & 0 deletions transform/translate.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.translate(@x: 0, @y: 0){
-webkit-transform: translate( @x , @y );
-moz-transform: translate( @x , @y );
-o-transform: translate( @x , @y );
-ms-transform: translate( @x , @y );
transform: translate( @x , @y );
}

0 comments on commit 446f001

Please sign in to comment.