-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_fonts.scss
104 lines (91 loc) · 2.94 KB
/
_fonts.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
// =============================================
//
// Fonts Mixins
//
// =============================================
//
// @mixin font-face
// @param $fontName {String} Unique name to identify your font (and use it with "font-family" if you wish)
// @param $className {String} Unique class name to extend for futur use (will generate %className)
//
// @desc:
// Register a new font familly to setup a %fontClassName to extend
//
@mixin register-font($fontName, $className){
%#{$className} {
font-family: $fontName;
font-weight: normal;
font-style: normal;
text-decoration: none;
}
}
//
// @mixin font-face
// @param $fontPath {String} relative or absolute path to font parent folder
// @param $fontFileName {String} font file name without extension (should be the same for each format)
// @param $fontName {String} Unique name to identify your font (and use it with "font-family" if you wish)
// @param $className {String} Unique class name to extend for futur use (will generate %className)
//
// @desc:
// Easily define a new font-face
//
@mixin font-face($fontPath, $fontFileName, $fontName, $className:null){
@font-face {
font-family: "#{$fontName}";
src: url("#{$fontPath}#{$fontFileName}.eot?");
src: url("#{$fontPath}#{$fontFileName}.eot?#iefix") format("embedded-opentype"),
url("#{$fontPath}#{$fontFileName}.woff") format("woff"),
url("#{$fontPath}#{$fontFileName}.ttf") format("truetype"),
url("#{$fontPath}#{$fontFileName}.svg##{$fontName}") format("svg");
font-weight: normal;
font-style: normal;
}
@if $className {
@include register-font($fontName, $className);
}
}
//
// @mixin create-icons-classes
// @param $fontClass {String} font class to extend all icons (ex: "%fontIcons", ".fontIcons")
// @param $fontFileName {String} font file name without extension (should be the same for each format)
// @param $fontName {String} Unique name to identify your font (and use it with "font-family" if you wish)
// @param $className {String} Unique class name to extend for futur use (will generate %className)
//
// @desc:
// Create icons classes
// I basically use it to create each ".icon-" class of my custom font icon
//
@mixin create-icons-classes($fontClass, $iconList)
{
@each $icon in $iconList {
$name: nth($icon, 1);
$code: nth($icon, 2);
.icon-#{$name} {
&:before {
@extend #{$fontClass};
content: $code;
@if (length($icon)>2) {
color: nth($icon, 3) !important;
}
}
}
%icon-#{$name} {
@extend #{$fontClass};
content: $code;
@if (length($icon)>2) {
color: nth($icon, 3) !important;
}
}
}
}
//
// @mixin set-font-size
// @param $to-size {px} font size in pixel that you want to convert
// @param $from-size {px} relative font size [default: $base-font-size]
//
// @desc:
// Define a relative font size
//
@mixin relative-font-size($to-size, $from-size: $base-font-size){
font-size: $font-unit * $to-size / $from-size;
}