1 |
|
2 | @function material-icons-str-replace($string, $search, $replace: '') {
|
3 | $index: str-index($string, $search);
|
4 | @if $index {
|
5 | @return str-slice($string, 1, $index - 1) + $replace +
|
6 | material-icons-str-replace(
|
7 | str-slice($string, $index + str-length($search)),
|
8 | $search,
|
9 | $replace
|
10 | );
|
11 | }
|
12 | @return $string;
|
13 | }
|
14 |
|
15 | @mixin material-icons-font-class($font-family) {
|
16 | font-family: $font-family;
|
17 | font-weight: normal;
|
18 | font-style: normal;
|
19 | font-size: $material-icons-font-size;
|
20 | line-height: 1;
|
21 | letter-spacing: normal;
|
22 | text-transform: none;
|
23 | display: inline-block;
|
24 | white-space: nowrap;
|
25 | word-wrap: normal;
|
26 | direction: ltr;
|
27 | -webkit-font-smoothing: antialiased;
|
28 | -moz-osx-font-smoothing: grayscale;
|
29 | text-rendering: optimizeLegibility;
|
30 | font-feature-settings: 'liga';
|
31 | }
|
32 |
|
33 | @mixin material-icons-font($font-family) {
|
34 | $class-name: to-lower-case($font-family);
|
35 | $class-name: material-icons-str-replace($class-name, ' ', '-');
|
36 | $font-file: $material-icons-font-path + $class-name;
|
37 |
|
38 | @font-face {
|
39 | font-family: $font-family;
|
40 | font-style: normal;
|
41 | font-weight: 400;
|
42 | font-display: $material-icons-font-display;
|
43 | src: url('#{$font-file}.woff2') format('woff2'),
|
44 | url('#{$font-file}.woff') format('woff');
|
45 | }
|
46 |
|
47 | .#{$class-name} {
|
48 | @include material-icons-font-class($font-family);
|
49 | }
|
50 | }
|
51 |
|
52 | @mixin material-icons() {
|
53 | @warn "material-icons() Sass mixin has been deprecated as of 1.0. Use '@extend .material-icons;' instead of '@include material-icons();'.";
|
54 | @include material-icons-font-class('Material Icons');
|
55 | }
|