Code cleanup, added comments.

pull/82/head
Macdonald, Zak 9 years ago
parent 467056d585
commit 3823a6e768

@ -1,9 +1,7 @@
// icon definitions
// --------------------------
// loop over key/value pairs
// - lifted shamelessly from: http://stackoverflow.com/questions/23658087/loop-over-an-array-of-name-value-pairs-in-less#answer-26445367
// create icon definitions
.createIconClasses(@iterator: 1) when(@iterator <= length(@wi-icon-glyphs)) {
@wi-glyph-name: extract(extract(@wi-icon-glyphs, @iterator), 1);

@ -4,12 +4,12 @@
.fa-icon() {
display: inline-block;
font: normal normal normal @wi-font-size-base/1 WeatherIcons; // shortening font declaration
font-size: inherit; // can't have font-size inherit on line above, so need to override
font: normal normal normal @wi-font-size-base/1 WeatherIcons; // shortening font declaration
text-rendering: auto; // optimizelegibility throws things off #1094
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transform: translate(0, 0); // ensures no half-pixel rendering in firefox
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
}
.wi-icon-rotate(@degrees) {
@ -17,14 +17,17 @@
& when (mod(@degrees, 90) = 0) {
@rotation: @degrees / 90;
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation);
}
-webkit-transform: rotate(~"@{degrees}deg");
-ms-transform: rotate(~"@{degrees}deg");
transform: rotate(~"@{degrees}deg");
}
.wi-icon-flip(@horiz, @vert, @rotation) {
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation, mirror=1);
-webkit-transform: scale(@horiz, @vert);
-ms-transform: scale(@horiz, @vert);

@ -6,35 +6,35 @@
"flip-vertical";
@z: '';
// calculate classes and values for rotation
.calculateRotations(@i) when (@i >= 0) {
// iterate
.calculateRotations((@i - 1));
@z: ~"@{wi-css-prefix}-rotate-@{i}";
.@{z} when (mod(@i, @wi-rotate-by) = 0) {
.wi-icon-rotate(@i);
}
.calculateRotations((@i - 1));
}
.calculateRotations(359);
// flip icons horizontal/vertical
.@{wi-css-prefix}-flip-horizontal { .wi-icon-flip(-1, 1, 0); }
.@{wi-css-prefix}-flip-vertical { .wi-icon-flip(1, -1, 2); }
// ie 8-9 fix
// -------------------------
// todo: check on assigning an array of selectors to the selector instead of this
// unnecessary duplication of code
// todo: check on assigning an array of selectors to the selector instead of using
// this loop
:root {
.calculateIEFixes(@i) when (@i >= 0) {
// iterate
.calculateIEFixes((@i - 1));
// iterate
.calculateIEFixes((@i - 1));
@z: ~"@{wi-css-prefix}-rotate-@{i}";

@ -11,7 +11,7 @@
.@{wi-css-prefix}-@{wi-icon-scale-name-unquoted} {
font-size: floor(@wi-font-size-base * @wi-icon-scale);
line-height: floor((@wi-font-size-base * @wi-icon-scale * 0.75);
line-height: floor(@wi-font-size-base * @wi-icon-scale * 0.75);
vertical-align: -15%;
}

@ -10,7 +10,25 @@
// @wi-inverse: #fff;
// @wi-li-width: (30em / 14);
// icon sizes - these scale font size and line height
// key value pair, creates selectors like `.wi-lg`
@wi-icon-scales:
"default" 1.000,
"lg" 1.333,
"sm" 0.666,
"xlg" 1.666,
"xsm" 0.333;
// icon size multipliers - these scale font size
// key value pair, creates selectors like `.w-2x`
@wi-icon-multipliers:
"2x" 2,
"3x" 3,
"4x" 4,
"5x" 5;
// icon glyphs
// key value pair, creates selectors like `.wi-day-cloudy`
@wi-icon-glyphs:
"_reserved_" "\f049",
"alien" "\f075",
@ -190,18 +208,3 @@
"wind-south-west" "\f05a",
"wind-west" "\f059",
"windy" "\f021";
// icon sizes - these scale font size and line height
@wi-icon-scales:
"default" 1.000,
"lg" 1.333,
"sm" 0.666,
"xlg" 1.666,
"xsm" 0.333;
// icon size multipliers - these scale font size
@wi-icon-multipliers:
"2x" 2.000,
"3x" 3.000,
"4x" 4.000,
"5x" 5.000;

@ -1,6 +1,7 @@
// icon definitions
// --------------------------
// create icon definitions
@each $wi-glyph-name, $wi-glyph-content in $wi-icon-glyphs {
.#{$wi-css-prefix}-#{$wi-glyph-name}:before {

@ -8,6 +8,7 @@ $rotations-requiring-ie-fix: (
);
$z: '';
// calculate classes and values for rotation
@for $i from 0 through 359 {
@if $i == 0 or $i % $wi-rotate-by == 0 {
@ -27,14 +28,14 @@ $z: '';
}
}
// flip icons horizontal/vertical
.#{$wi-css-prefix}-flip-horizontal { @include wi-icon-flip(-1, 1, 0); }
.#{$wi-css-prefix}-flip-vertical { @include wi-icon-flip(1, -1, 2); }
// ie 8-9 fix
// -------------------------
// todo: check on assigning an array of selectors to the selector instead of this
// unnecessary duplication of code
// todo: check on assigning an array of selectors to the selector instead of using
// this loop
:root {

@ -10,7 +10,27 @@ $wi-version : "2.0.0" !default;
// $wi-inverse: #fff !default;
// $wi-li-width: (30em / 14) !default;
// icon sizes - these scale font size and line height
// key value pair, creates selectors like `.wi-lg`
$wi-icon-scales: (
"default": 1.000,
"lg" : 1.333,
"sm" : 0.666,
"xlg" : 1.666,
"xsm" : 0.333
) !default;
// icon size multipliers - these scale font size
// key value pair, creates selectors like `.w-2x`
$wi-icon-multipliers: (
"2x": 2.000,
"3x": 3.000,
"4x": 4.000,
"5x": 5.000
) !default;
// icon glyphs
// key value pair, creates selectors like `.wi-day-cloudy`
$wi-icon-glyphs: (
"_reserved_" : "\f049",
"alien" : "\f075",
@ -191,20 +211,3 @@ $wi-icon-glyphs: (
"wind-west" : "\f059",
"windy" : "\f021"
) !default;
// icon sizes - these scale font size and line height
$wi-icon-scales: (
"default": 1.000,
"lg" : 1.333,
"sm" : 0.666,
"xlg" : 1.666,
"xsm" : 0.333
) !default;
// icon size multipliers - these scale font size
$wi-icon-multipliers: (
"2x": 2.000,
"3x": 3.000,
"4x": 4.000,
"5x": 5.000
) !default;

Loading…
Cancel
Save