1 /// Makes an element's :before pseudoelement a FontAwesome icon.
2 /// @param {string} $content Optional content value to use.
3 /// @param {string} $category Optional category to use.
4 /// @param {string} $where Optional pseudoelement to target (before or after).
5 @mixin icon($content: false, $category: regular, $where: before) {
15 -moz-osx-font-smoothing: grayscale;
16 -webkit-font-smoothing: antialiased;
17 display: inline-block;
22 text-transform: none !important;
24 @if ($category == brands) {
25 font-family: 'Font Awesome 5 Brands';
27 @elseif ($category == solid) {
28 font-family: 'Font Awesome 5 Free';
32 font-family: 'Font Awesome 5 Free';
40 /// Applies padding to an element, taking the current element-margin value into account.
41 /// @param {mixed} $tb Top/bottom padding.
42 /// @param {mixed} $lr Left/right padding.
43 /// @param {list} $pad Optional extra padding (in the following order top, right, bottom, left)
44 /// @param {bool} $important If true, adds !important.
45 @mixin padding($tb, $lr, $pad: (0,0,0,0), $important: null) {
48 $important: '!important';
53 @if unit(_size(element-margin)) == 'rem' {
57 padding: ($tb + nth($pad,1)) ($lr + nth($pad,2)) max($x, $tb - _size(element-margin) + nth($pad,3)) ($lr + nth($pad,4)) #{$important};
61 /// Encodes a SVG data URL so IE doesn't choke (via codepen.io/jakob-e/pen/YXXBrp).
62 /// @param {string} $svg SVG data URL.
63 /// @return {string} Encoded SVG data URL.
64 @function svg-url($svg) {
66 $svg: str-replace($svg, '"', '\'');
67 $svg: str-replace($svg, '%', '%25');
68 $svg: str-replace($svg, '<', '%3C');
69 $svg: str-replace($svg, '>', '%3E');
70 $svg: str-replace($svg, '&', '%26');
71 $svg: str-replace($svg, '#', '%23');
72 $svg: str-replace($svg, '{', '%7B');
73 $svg: str-replace($svg, '}', '%7D');
74 $svg: str-replace($svg, ';', '%3B');
76 @return url("data:image/svg+xml;charset=utf8,#{$svg}");