gulp tasks and nunjucks templating
- reworked nearly all gulp tasks - added html templating with nunjucks - replaced some old html files - started correction of scss and js files according to lint results
This commit is contained in:
parent
6e4b8cf94b
commit
b8733af03c
37 changed files with 3911 additions and 200 deletions
101
source/style/modules/media/_sprites.scss
Normal file
101
source/style/modules/media/_sprites.scss
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
// SCSS variables are information about icon's compiled state, stored under its original file name
|
||||
//
|
||||
// .icon-home {
|
||||
// width: $icon-home-width;
|
||||
// }
|
||||
//
|
||||
// The large array-like variables contain all information about a single icon
|
||||
// $icon-home: x y offset_x offset_y width height total_width total_height image_path;
|
||||
//
|
||||
// At the bottom of this section, we provide information about the spritesheet itself
|
||||
// $spritesheet: width height image $spritesheet-sprites;
|
||||
$down-name: 'down';
|
||||
$down-x: 32px;
|
||||
$down-y: 0px;
|
||||
$down-offset-x: -32px;
|
||||
$down-offset-y: 0px;
|
||||
$down-width: 32px;
|
||||
$down-height: 32px;
|
||||
$down-total-width: 64px;
|
||||
$down-total-height: 64px;
|
||||
$down-image: 'sprites.png';
|
||||
$down: (32px, 0px, -32px, 0px, 32px, 32px, 64px, 64px, 'sprites.png', 'down', );
|
||||
$up-name: 'up';
|
||||
$up-x: 0px;
|
||||
$up-y: 0px;
|
||||
$up-offset-x: 0px;
|
||||
$up-offset-y: 0px;
|
||||
$up-width: 32px;
|
||||
$up-height: 64px;
|
||||
$up-total-width: 64px;
|
||||
$up-total-height: 64px;
|
||||
$up-image: 'sprites.png';
|
||||
$up: (0px, 0px, 0px, 0px, 32px, 64px, 64px, 64px, 'sprites.png', 'up', );
|
||||
$spritesheet-width: 64px;
|
||||
$spritesheet-height: 64px;
|
||||
$spritesheet-image: 'sprites.png';
|
||||
$spritesheet-sprites: ($down, $up, );
|
||||
$spritesheet: (64px, 64px, 'sprites.png', $spritesheet-sprites, );
|
||||
|
||||
// The provided mixins are intended to be used with the array-like variables
|
||||
//
|
||||
// .icon-home {
|
||||
// @include sprite-width($icon-home);
|
||||
// }
|
||||
//
|
||||
// .icon-email {
|
||||
// @include sprite($icon-email);
|
||||
// }
|
||||
//
|
||||
// Example usage in HTML:
|
||||
//
|
||||
// `display: block` sprite:
|
||||
// <div class="icon-home"></div>
|
||||
//
|
||||
// To change `display` (e.g. `display: inline-block;`), we suggest using a common CSS class:
|
||||
//
|
||||
// // CSS
|
||||
// .icon {
|
||||
// display: inline-block;
|
||||
// }
|
||||
//
|
||||
// // HTML
|
||||
// <i class="icon icon-home"></i>
|
||||
@mixin sprite-width($sprite) {
|
||||
width: nth($sprite, 5);
|
||||
}
|
||||
|
||||
@mixin sprite-height($sprite) {
|
||||
height: nth($sprite, 6);
|
||||
}
|
||||
|
||||
@mixin sprite-position($sprite) {
|
||||
$sprite-offset-x: nth($sprite, 3);
|
||||
$sprite-offset-y: nth($sprite, 4);
|
||||
background-position: $sprite-offset-x $sprite-offset-y;
|
||||
}
|
||||
|
||||
@mixin sprite-image($sprite) {
|
||||
$sprite-image: nth($sprite, 9);
|
||||
background-image: url(#{$sprite-image});
|
||||
}
|
||||
|
||||
@mixin sprite($sprite) {
|
||||
@include sprite-image($sprite);
|
||||
@include sprite-position($sprite);
|
||||
@include sprite-width($sprite);
|
||||
@include sprite-height($sprite);
|
||||
}
|
||||
|
||||
// The `sprites` mixin generates identical output to the CSS template
|
||||
// but can be overridden inside of SCSS
|
||||
//
|
||||
// @include sprites($spritesheet-sprites);
|
||||
@mixin sprites($sprites) {
|
||||
@each $sprite in $sprites {
|
||||
$sprite-name: nth($sprite, 10);
|
||||
.#{$sprite-name} {
|
||||
@include sprite($sprite);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue