-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
2,060 additions
and
2,318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,5 @@ | |
, 'material-shadow' | ||
, 'font-size' | ||
, 'on-event' | ||
, 'load-fonts' | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
@charset 'UTF-8'; | ||
|
||
//// | ||
/// Font loading function. | ||
/// @group functions | ||
//// | ||
|
||
/// Global default fonts. | ||
$fonts: () !default; | ||
|
||
/// Keeps track of already loaded fonts. | ||
$loaded-fonts: (); | ||
|
||
/// Load a collection of @font-face fonts | ||
/// | ||
@mixin load-fonts($load: $fonts) { | ||
|
||
// Lists. | ||
@if type-of($load) == list { | ||
// Loop through each item in the passed in list. | ||
@each $_item in $load { | ||
// Cast the item to a string to be sure we don't pass | ||
// strange variables to the loader. | ||
$_item_string: #{$_item}; | ||
@if (_is-loaded_font($_item_string) == false) { | ||
$_tmp: _log-loaded-font($_item_string); | ||
$_item_string: quote($_item_string); | ||
@import url($_item_string); | ||
} | ||
@else { | ||
@debug "Font: #{$_item_string} already loaded."; | ||
} | ||
} | ||
} | ||
|
||
// Maps. | ||
@if type-of($load) == map { | ||
// Loop through each item in the passed in map. | ||
@each $_index, $_item in $load { | ||
@each $_font in $_item { | ||
// Cast the item to a string to be sure we don't pass | ||
// strange variables to the loader. | ||
$_item_string: #{$_font}; | ||
@if (_is-loaded_font($_item_string) == false) { | ||
$_tmp: _log-loaded-font($_item_string); | ||
$_item_string: quote($_item_string); | ||
@import url($_item_string); | ||
} | ||
@else { | ||
@debug "Font: #{$_item_string} already loaded."; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
/// Internal function to keep track of loaded fonts | ||
/// so we don't duplicate calls. | ||
@function _log-loaded-font($url) { | ||
$loaded-fonts: append($loaded-fonts, $url, comma) !global; | ||
@return true; | ||
} | ||
|
||
|
||
/// Checks the global variable for loaded fonts | ||
@function _is-loaded_font($url) { | ||
$_value: index($loaded-fonts, $url); | ||
@if type-of($_value) == number { | ||
@return true; | ||
} | ||
@return false; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.