Add icon documentation, have a bit of a re-org

This commit is contained in:
Mark Perkins
2012-06-26 15:06:39 +01:00
parent 6c6d4681b5
commit e48aab5f0c
15 changed files with 369 additions and 56 deletions

249
README.md
View File

@@ -555,7 +555,7 @@ The sprite mixins give you an easy way to use sprited background images. It assu
### SETTING: @sprite-image ### SETTING: @sprite-image
```css ```css
@sprite-image: url('/images/example-sprite.png'); @sprite-image: '/images/example-sprite.png';
``` ```
The default image to use for the sprite mixins. Can be a Base64 encoded data-uri. The default image to use for the sprite mixins. Can be a Base64 encoded data-uri.
@@ -625,6 +625,9 @@ The same as the `.sprite()` mixin above, but allows you to specify the height an
.example { .example {
.sprite-sized( 2, 3, 16px, 32px ); .sprite-sized( 2, 3, 16px, 32px );
} }
.example2 {
.sprite-sized( 2, 3, 16px );
}
/* Example output: */ /* Example output: */
.example { .example {
background-image: url('/images/example-sprite.png'); background-image: url('/images/example-sprite.png');
@@ -633,6 +636,13 @@ The same as the `.sprite()` mixin above, but allows you to specify the height an
width: 16px; width: 16px;
height: 32px; height: 32px;
} }
.example2 {
background-image: url('/images/example-sprite.png');
background-repeat: no-repeat;
background-position: -100px -150px;
width: 16px;
height: 16px;
}
``` ```
### .sprite-ir() ### .sprite-ir()
@@ -665,6 +675,9 @@ Augments the `.sprite-sized()` mixin to include image replacement properties as
.example { .example {
.sprite-ir( 2, 3, 16px, 32px ); .sprite-ir( 2, 3, 16px, 32px );
} }
.example2 {
.sprite-ir( 2, 3, 16px );
}
/* Example output: */ /* Example output: */
.example { .example {
background-image: url('/images/example-sprite.png'); background-image: url('/images/example-sprite.png');
@@ -678,6 +691,18 @@ Augments the `.sprite-sized()` mixin to include image replacement properties as
color: transparent; color: transparent;
background-color: transparent; background-color: transparent;
} }
.example2 {
background-image: url('/images/example-sprite.png');
background-repeat: no-repeat;
background-position: -100px -150px;
width: 16px;
height: 16px;
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
``` ```
### .sprite-image() ### .sprite-image()
@@ -748,7 +773,10 @@ Similar to the `.sprite-pos()` [partial mixin](#optimising-output-using-partial-
```css ```css
/* Usage: */ /* Usage: */
.example { .example {
.sprite-pos-sized(2,3, 16px, 32px); .sprite-pos-sized( 2, 3, 16px, 32px );
}
.example2 {
.sprite-pos-sized( 2, 3, 16px );
} }
/* Example output: */ /* Example output: */
.example { .example {
@@ -756,12 +784,227 @@ Similar to the `.sprite-pos()` [partial mixin](#optimising-output-using-partial-
width: 16px; width: 16px;
height: 32px; height: 32px;
} }
.example2 {
background-position: -100px -150px;
width: 16px;
height: 16px;
}
``` ```
Icons Icons
------- -------
Documentation coming soon. The icons mixins let you easily place an icon before or after an element, using absolutely positioned :before and :after pseudo elements to display them. There are also sprited icon mixins build on the sprite mixins above.
### .prepend-icon()
Prepends an icon to the element it's called on.
```css
.prepend-icon( <@icon-image>, <@width>, <@height>[, <@nudge-left>[, <@nudge-top>[, <@pad>]]] );
```
* `@icon-image`: URL or data URI of an image to use for the prepended icon
* `@width`: Width of the image
* `@height`: Height of the image
* `@nudge-left`: The value of the `left` property for the icon. Defaults to `0`.
* `@nudge-top`: The value of the `top` property for the icon. Defaults to `0`.
* `@pad`: Left-padding (in addition to the width of the icon) to apply to the element. Defaults to `10px`
```css
/* Usage: */
.example {
.prepend-icon( 'img/icon.png', 16px, 32px );
}
/* Example output: */
.example {
position: relative;
padding-left: 42px;
}
.example:before {
position: absolute;
display: block;
content: ' ';
background: url('img/icon.png') no-repeat 0 0;
width: 16px;
height: 32px;
top: 0;
left: 0;
}
```
### .append-icon()
Appends an icon after the element it's called on.
```css
.append-icon( <@icon-image>, <@width>, <@height>[, <@nudge-right>[, <@nudge-top>[, <@pad>]]] );
```
* `@icon-image`: URL or data URI of an image to use for the prepended icon
* `@width`: Width of the image
* `@height`: Height of the image
* `@nudge-right`: The value of the `right` property for the icon. Defaults to `0`.
* `@nudge-top`: The value of the `top` property for the icon. Defaults to `0`.
* `@pad`: Left-padding (in addition to the width of the icon) to apply to the element. Defaults to `10px`
```css
/* Usage: */
.example {
.append-icon( 'img/icon.png', 16px, 32px );
}
/* Example output: */
.example {
position: relative;
padding-right: 42px;
}
.example:after {
position: absolute;
display: block;
content: ' ';
background: url('img/icon.png') no-repeat 0 0;
width: 16px;
height: 32px;
top: 0;
right: 0;
}
```
### .prepend-sprite-icon()
Prepends an icon taken from the sprite to the element it's called on.
```css
.prepend-sprite-icon( <@x>, <@y>, <@width>, <@height>[, <@nudge-left>[, <@nudge-top>[, <@pad>[, <@sprite-image>[, <@sprite-grid>]]]]] );
```
* `@x`: The x coordinate of the desired image on the grid.
* `@y`: The y coordinate of the desired image on the grid.
* `@width`: Width of the image
* `@height`: Height of the image
* `@nudge-left`: The value of the `left` property for the icon. Defaults to `0`.
* `@nudge-top`: The value of the `top` property for the icon. Defaults to `0`.
* `@pad`: Left-padding (in addition to the width of the icon) to apply to the element. Defaults to `10px`
* `@sprite-image`: The sprite image to use. Defaults to the globally defined `@sprite-image` value.
* `@sprite-grid`: The grid size used in the sprite. Defaults to the globally defined `@sprite-grid` value.
```css
/* Usage: */
.example {
.prepend-sprite-icon( 1, 2, 16px, 32px );
}
/* Example output: */
.example {
position: relative;
padding-left: 42px;
}
.example:before {
position: absolute;
display: block;
content: ' ';
background-image: url('/images/example-sprite.png');
background-repeat: no-repeat;
background-position: -50px -100px;
width: 16px;
height: 32px;
top: 0;
left: 0;
}
```
### .append-sprite-icon()
Appends an icon taken from the sprite after the element it's called on.
```css
.append-sprite-icon( <@x>, <@y>, <@width>, <@height>[, <@nudge-right>[, <@nudge-top>[, <@pad>[, <@sprite-image>[, <@sprite-grid>]]]]] );
```
* `@x`: The x coordinate of the desired image on the grid.
* `@y`: The y coordinate of the desired image on the grid.
* `@width`: Width of the image
* `@height`: Height of the image
* `@nudge-right`: The value of the `right` property for the icon. Defaults to `0`.
* `@nudge-top`: The value of the `top` property for the icon. Defaults to `0`.
* `@pad`: Left-padding (in addition to the width of the icon) to apply to the element. Defaults to `10px`
* `@sprite-image`: The sprite image to use. Defaults to the globally defined `@sprite-image` value.
* `@sprite-grid`: The grid size used in the sprite. Defaults to the globally defined `@sprite-grid` value.
```css
/* Usage: */
.example {
.append-sprite-icon( 1, 2, 16px, 32px );
}
/* Example output: */
.example {
position: relative;
padding-right: 42px;
}
.example:after {
position: absolute;
display: block;
content: ' ';
background-image: url('/images/example-sprite.png');
background-repeat: no-repeat;
background-position: -50px -100px;
width: 16px;
height: 32px;
top: 0;
right: 0;
}
```
### .prepend-sprite-icon-pos()
Adjusts the positioning of a prepended sprite icon.
```css
.prepend-sprite-icon-pos( <@x>, <@y>[, <@nudge-left>[, <@nudge-top>[, <@sprite-grid>]]] );
```
* `@x`: The x coordinate of the desired image on the grid.
* `@y`: The y coordinate of the desired image on the grid.
* `@nudge-left`: The value of the `left` property for the icon. Defaults to `0`.
* `@nudge-top`: The value of the `top` property for the icon. Defaults to `0`.
* `@sprite-grid`: The grid size used in the sprite. Defaults to the globally defined `@sprite-grid` value.
```css
/* Usage: */
.example {
.prepend-sprite-icon-pos( 1, 2 );
}
/* Example output: */
.example:before {
background-position: -50px -100px;
}
```
### .append-sprite-icon-pos()
Adjusts the positioning of a appended sprite icon.
```css
.append-sprite-icon-pos( <@x>, <@y>[, <@nudge-right>[, <@nudge-top>[, <@sprite-grid>]]] );
```
* `@x`: The x coordinate of the desired image on the grid.
* `@y`: The y coordinate of the desired image on the grid.
* `@nudge-right`: The value of the `left` property for the icon. Defaults to `0`.
* `@nudge-top`: The value of the `top` property for the icon. Defaults to `0`.
* `@sprite-grid`: The grid size used in the sprite. Defaults to the globally defined `@sprite-grid` value.
```css
/* Usage: */
.example {
.append-sprite-icon-pos( 1, 2 );
}
/* Example output: */
.example:after {
background-position: -50px -100px;
}
```
Grids Grids

View File

@@ -276,7 +276,7 @@ h2 {
position: absolute; position: absolute;
display: block; display: block;
content: ' '; content: ' ';
background-image: url('../examples/sprite.png'); background-image: url('../img/sprite.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: -100px -50px; background-position: -100px -50px;
width: 6px; width: 6px;
@@ -454,11 +454,11 @@ h2 {
display: inline; display: inline;
zoom: 1; zoom: 1;
} }
.more:before { .more:after {
position: absolute; position: absolute;
display: block; display: block;
content: ' '; content: ' ';
background-image: url('../examples/sprite.png'); background-image: url('../img/sprite.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: -100px -50px; background-position: -100px -50px;
width: 6px; width: 6px;
@@ -481,7 +481,7 @@ h2 {
position: absolute; position: absolute;
display: block; display: block;
content: ' '; content: ' ';
background-image: url('../examples/sprite.png'); background-image: url('../img/sprite.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 0px 0px; background-position: 0px 0px;
width: 28px; width: 28px;
@@ -513,4 +513,18 @@ h2 {
.icon-nav .ghosts a:hover:before { .icon-nav .ghosts a:hover:before {
background-position: -50px -150px; background-position: -50px -150px;
} }
.icon.twitter {
position: relative;
padding-left: 42px;
}
.icon.twitter:before {
position: absolute;
display: block;
content: ' ';
background: url('../img/twitter-32x32.png') no-repeat 0 0;
width: 32px;
height: 32px;
top: -8px;
left: 0;
}
/* Other Helpers */ /* Other Helpers */

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../_compiled/example.css" type="text/css"> <link rel="stylesheet" href="css/example.css" type="text/css">
<title>ClearLESS Examples</title> <title>ClearLESS Examples</title>
</head> </head>

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../_compiled/example.css" type="text/css"> <link rel="stylesheet" href="css/example.css" type="text/css">
<title>ClearLESS Examples</title> <title>ClearLESS Examples</title>
</head> </head>

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +1,8 @@
@import "../mixins/all"; @import "../../mixins/all";
// Default settings override // Default settings override
@sprite-image: url('../examples/sprite.png'); @sprite-image: '../img/sprite.png';
@using-modernizr: false; @using-modernizr: false;
@using-ieclasses: true; @using-ieclasses: true;
@@ -14,7 +14,7 @@
// Project settings // Project settings
@mobile-width: 40em; @mobile-width: 40em;
/* ---- reset ---- */ /* ---- reset ---- */
.normalize(); .normalize();
@@ -56,7 +56,7 @@ h2 {
} }
a { a {
.inline-block(); .inline-block();
.icon(2, 1, 6px, 11px, 10px, 0, 4px); .prepend-sprite-icon(2, 1, 6px, 11px, 0, 4px);
} }
} }
@@ -240,7 +240,7 @@ h2 {
.more { .more {
.inline-block(); .inline-block();
.right-icon(2, 1, 6px, 11px, 10px, 0, 4px); .append-sprite-icon(2, 1, 6px, 11px, 0, 4px);
} }
.icon-nav { .icon-nav {
@@ -248,34 +248,38 @@ h2 {
.inline-block(); .inline-block();
padding-top: 10px; padding-top: 10px;
padding-bottom: 10px; padding-bottom: 10px;
.icon(0, 0, 28px, 28px, 10px, 0, 2px); .prepend-sprite-icon(0, 0, 28px, 28px, 0, 2px);
} }
.robots a { .robots a {
.icon-pos(0,0); .prepend-sprite-icon-pos(0,0);
&:hover { &:hover {
.icon-pos(1,0); .prepend-sprite-icon-pos(1,0);
} }
} }
.rockets a { .rockets a {
.icon-pos(0,1); .prepend-sprite-icon-pos(0,1);
&:hover { &:hover {
.icon-pos(1,1); .prepend-sprite-icon-pos(1,1);
} }
} }
.runners a { .runners a {
.icon-pos(0,2); .prepend-sprite-icon-pos(0,2);
&:hover { &:hover {
.icon-pos(1,2); .prepend-sprite-icon-pos(1,2);
} }
} }
.ghosts a { .ghosts a {
.icon-pos(0,3); .prepend-sprite-icon-pos(0,3);
&:hover { &:hover {
.icon-pos(1,3); .prepend-sprite-icon-pos(1,3);
} }
} }
} }
.icon.twitter {
.prepend-icon('../img/twitter-32x32.png', 32px, 32px, 0, -8px);
}
/* Other Helpers */ /* Other Helpers */

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../_compiled/example.css" type="text/css"> <link rel="stylesheet" href="css/example.css" type="text/css">
<title>ClearLESS Examples</title> <title>ClearLESS Examples</title>
</head> </head>

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../_compiled/example.css" type="text/css"> <link rel="stylesheet" href="css/example.css" type="text/css">
<title>ClearLESS Examples</title> <title>ClearLESS Examples</title>
</head> </head>

View File

@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="http://clearleft.com/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="../_compiled/example.css" type="text/css"> <link rel="stylesheet" href="css/example.css" type="text/css">
<title>ClearLESS Examples</title> <title>ClearLESS Examples</title>
</head> </head>
@@ -34,5 +34,12 @@
</div> </div>
<div class="receptacle">
<p><a href="#" class="icon twitter">Twitter</a></p>
</div>
</body> </body>
</html> </html>

View File

@@ -59,7 +59,6 @@
} }
} }
// Gradients
#gradient { #gradient {
.horizontal (@start-color, @end-color) when not (@disable-filters) { .horizontal (@start-color, @end-color) when not (@disable-filters) {
background-color: @end-color; background-color: @end-color;
@@ -113,7 +112,6 @@
filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color)); /* IE6 & IE7 */ filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color)); /* IE6 & IE7 */
-ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color); /* IE8+ */ -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@start-color,@end-color); /* IE8+ */
} }
} }
// Helpers -------------------------------- // Helpers --------------------------------

View File

@@ -4,51 +4,99 @@
// These can only be used on block or inline-block elements. // These can only be used on block or inline-block elements.
// ============================================== // ==============================================
.icon(@x, @y, @width, @height, @pad:10, @nudge-left:0, @nudge-top:0, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) { // Non-sprited icons --------------------------------
.prepend-icon( @icon-image, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10 ) when (@using-modernizr) {
.generatedcontent & { .generatedcontent & {
position: relative; position: relative;
padding-left: (@width + @pad) * 1px; padding-left: (@width + @pad) * 1px;
} }
.generatedcontent &:before { .generatedcontent &:before {
._generated-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); ._generated-icon( @width, @height, @icon-image );
top: @nudge-top; top: @nudge-top;
left: @nudge-left; left: @nudge-left;
} }
} }
.icon(@x, @y, @width, @height, @pad:10, @nudge-left:0, @nudge-top:0, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr = false) { .prepend-icon( @icon-image, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10 ) when not (@using-modernizr) {
position: relative; position: relative;
padding-left: (@width + @pad) * 1px; padding-left: (@width + @pad) * 1px;
&:before { &:before {
._generated-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); ._generated-icon( @width, @height, @icon-image );
top: @nudge-top; top: @nudge-top;
left: @nudge-left; left: @nudge-left;
} }
} }
.right-icon(@x, @y, @width, @height, @pad:10, @nudge-right:0, @nudge-top:0, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) { .append-icon( @icon-image, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10 ) when (@using-modernizr) {
.generatedcontent & {
position: relative;
padding-right: (@width + @pad) * 1px;
}
.generatedcontent &:after {
._generated-icon( @width, @height, @icon-image );
top: @nudge-top;
right: @nudge-right;
}
}
.append-icon( @icon-image, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10 ) when not (@using-modernizr) {
position: relative;
padding-right: (@width + @pad) * 1px;
.generatedcontent &:after {
._generated-icon( @width, @height, @icon-image );
top: @nudge-top;
right: @nudge-right;
}
}
// Sprited icons --------------------------------
.prepend-sprite-icon(@x, @y, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) {
.generatedcontent & {
position: relative;
padding-left: (@width + @pad) * 1px;
}
.generatedcontent &:before {
._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid );
top: @nudge-top;
left: @nudge-left;
}
}
.prepend-sprite-icon(@x, @y, @width, @height, @nudge-left:0, @nudge-top:0, @pad:10, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (@using-modernizr) {
position: relative;
padding-left: (@width + @pad) * 1px;
&:before {
._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid );
top: @nudge-top;
left: @nudge-left;
}
}
.append-sprite-icon(@x, @y, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr) {
.generatedcontent & { .generatedcontent & {
padding-right: (@width + @pad) * 1px; padding-right: (@width + @pad) * 1px;
position: relative; position: relative;
} }
.generatedcontent &:before { .generatedcontent &:after {
._generated-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid );
top: @nudge-top; top: @nudge-top;
right: @nudge-right; right: @nudge-right;
} }
} }
.right-icon(@x, @y, @width, @height, @pad:10, @nudge-right:0, @nudge-top:0, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when (@using-modernizr = false) { .append-sprite-icon(@x, @y, @width, @height, @nudge-right:0, @nudge-top:0, @pad:10, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) when not (@using-modernizr) {
position: relative; position: relative;
padding-right: (@width + @pad) * 1px; padding-right: (@width + @pad) * 1px;
&:before { &:after {
._generated-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid ); ._generated-sprite-icon( @x, @y, @width, @height, @sprite-image, @sprite-grid );
top: @nudge-top; top: @nudge-top;
right: @nudge-right; right: @nudge-right;
} }
} }
.icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) { .prepend-sprite-icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) {
.generatedcontent &:before { .generatedcontent &:before {
.sprite-pos(@x, @y, @sprite-grid); .sprite-pos(@x, @y, @sprite-grid);
.nudge-l(@nudge-left); .nudge-l(@nudge-left);
@@ -56,7 +104,7 @@
} }
} }
.icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) { .prepend-sprite-icon-pos(@x, @y, @nudge-left:0, @nudge-top:0, @sprite-grid:@sprite-grid) when not (@using-modernizr) {
&:before { &:before {
.sprite-pos(@x, @y, @sprite-grid); .sprite-pos(@x, @y, @sprite-grid);
.nudge-l(@nudge-left); .nudge-l(@nudge-left);
@@ -64,16 +112,16 @@
} }
} }
.right-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) { .append-sprite-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) when (@using-modernizr) {
.generatedcontent &:before { .generatedcontent &:after {
.sprite-pos(@x, @y, @sprite-grid); .sprite-pos(@x, @y, @sprite-grid);
.nudge-r(@nudge-right); .nudge-r(@nudge-right);
.nudge-t(@nudge-top); .nudge-t(@nudge-top);
} }
} }
.right-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) { .append-sprite-icon-pos(@x, @y, @nudge-right:0, @nudge-top:0, @sprite-grid:@sprite-grid) when not (@using-modernizr) {
&:before { &:after {
.sprite-pos(@x, @y, @sprite-grid); .sprite-pos(@x, @y, @sprite-grid);
.nudge-r(@nudge-right); .nudge-r(@nudge-right);
.nudge-t(@nudge-top); .nudge-t(@nudge-top);
@@ -82,7 +130,15 @@
// ---- internal use mixins ----------------------- // ---- internal use mixins -----------------------
._generated-icon(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) { ._generated-icon(@width, @height, @icon-image) {
position: absolute;
display: block;
content: ' ';
background: url(@icon-image) no-repeat 0 0;
.size(@width, @height);
}
._generated-sprite-icon(@x, @y, @width, @height, @sprite-image:@sprite-image, @sprite-grid:@sprite-grid) {
position: absolute; position: absolute;
display: block; display: block;
content: ' '; content: ' ';

View File

@@ -16,7 +16,7 @@
// Sprites -------------------------------- // Sprites --------------------------------
@sprite-image: url('/example.png'); @sprite-image: '/example.png';
@sprite-grid: 50px; @sprite-grid: 50px;
// Grid -------------------------------- // Grid --------------------------------

View File

@@ -30,7 +30,7 @@
} }
.sprite-image(@sprite-image:@sprite-image) { .sprite-image(@sprite-image:@sprite-image) {
background-image: @sprite-image; background-image: url(@sprite-image);
background-repeat: no-repeat; background-repeat: no-repeat;
} }