Skip to content

Instantly share code, notes, and snippets.

@nolros
Created June 18, 2021 05:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nolros/04dbfdff2c4bb1240b967ca8788c55e9 to your computer and use it in GitHub Desktop.
Save nolros/04dbfdff2c4bb1240b967ca8788c55e9 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
@function str-replace($string, $search, $replace: "") {
$index: str-index($string, $search);
@if $index {
@return str-slice($string, 1, $index - 1) + $replace +
str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
}
@return $string;
}
@mixin font-face($name, $path, $weight: null, $style: null, $local, $exts: eot woff2 woff ttf svg) {
$src: null;
$src: append($src, local(quote($local)), comma);
$extmods: (
eot: "?",
svg: "#" + str-replace($name, " ", "_")
);
$formats: (
otf: "opentype",
ttf: "truetype"
);
@each $ext in $exts {
$extmod: if(map-has-key($extmods, $ext), $ext + map-get($extmods, $ext), $ext);
$format: if(map-has-key($formats, $ext), map-get($formats, $ext), $ext);
$src: append($src, url(quote($path + "." + $extmod)) format(quote($format)), comma);
}
@font-face {
font-family: quote($name);
font-style: $style;
font-weight: $weight;
font-display: swap;
src: $src;
}
}
$fonts: (
(Lato,"./fonts/lato/lato-v17-latin-900",900,normal,Lato,woff woff2),
(Lato,"./fonts/lato/lato-v17-latin-900italic",900,italic,Lato,woff woff2),
(Lato,"./fonts/lato/lato-v17-latin-700",700,normal,Lato,woff woff2),
(Lato,"./fonts/lato/lato-v17-latin-700italic",700,italic,Lato,woff woff2),
);
@each $name, $path, $weight, $style, $local, $exts in $fonts {
@include font-face($name, $path, $weight, $style, $local, $exts);
}
// @include font-face($name, $path, $weight, $style);
// @include font-face(Samplinal, fonts/Samplinal, 500, normal, eot woff2 woff);
// @mixin sentence-case() {
// text-transform: lowercase;
// &:first-letter {
// text-transform: uppercase;
// }
// }
// .sentenceCase {
// @include sentence-case();
// }
// @mixin font-face($name, $path, $weight: normal, $style: normal) {
// @font-face {
// font-family: quote($name);
// src: local(quote($name));
// font-weight: $weight;
// font-style: $style;
// font-display: swap;
// url('../fonts/lato/lato-v17-latin-900italic.woff') format('woff');
// }
// }
// url($path+".eot");
// url($path+".eot");
// url('../fonts/lato/lato-v17-latin-900italic.woff') format('woff');
// #{$font-size}/
// #{$font-size}
// @mixin corner-icon($name, $top-or-bottom, $left-or-right) {
// .icon-#{$name} {
// background-image: url("/icons/#{$name}.svg");
// position: absolute;
// #{$top-or-bottom}: 0;
// #{$left-or-right}: 0;
// }
// }
// @include corner-icon("mail", top, left);
// src: url("./fonts/#{to-lower-case(#{$name})/#{$path}.woff");
// src: url("./fonts/#{to-lower-case(#{$name})/#{$path}.woff");
// @include font-face($name, $path, $weight, $style);
// @font-face {
// font-family: 'Lato';
// font-style: normal;
// font-weight: 900;
// src: local(''),
// url('../fonts/lato/lato-v17-latin-900.woff2') format('woff2'), /* Chrome 26+, Opera 23+, Firefox 39+ */
// url('../fonts/lato/lato-v17-latin-900.woff') format('woff'); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
// }
// @each $fonts, $i in $font {
// .#{$i}-#{$number} {
// /* CSS styles */
// }
// @include font-face(Roboto, "./assets/Roboto", normal, normal);
// }
// @include font-face(Roboto, "./assets/Roboto", normal, normal);
// p {
// @each $label, $min-width, $max-width, $base-font, $vertical-rhythm in $breakpoint-list {
// @if $min-width {
// @include breakpoint( $min-width ) {
// font-size: $base-font;
// line-height: $vertical-rhythm;
// }
// } @else {
// font-size: $base-font;
// line-height: $vertical-rhythm;
// }
// }
// }
// $breakpoint-list: (
// (small, null, 479px, 16px, 1.3),
// (medium, 480px, 959px, 18px, 1.414),
// (large, 960px, 1099px, 18px, 1.5),
// (xlarge, 1100px, null, 21px, 1.618)
// );
// p {
// @each $label, $min-width, $max-width, $base-font, $vertical-rhythm in $breakpoint-list {
// @if $min-width {
// @include breakpoint( $min-width ) {
// font-size: $base-font;
// line-height: $vertical-rhythm;
// }
// } @else {
// font-size: $base-font;
// line-height: $vertical-rhythm;
// }
// }
// // }
// @font-face {
// font-family: 'myFont';
// font-weight: 400;
// font-style: normal;
// font-display: swap;
// unicode-range: U+000-5FF
// src: local('myFont'),
// url('/fonts/myFont.woff2') format('woff2'),
// url('/fonts/myFont.woff') format('woff');
// }
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 900;
font-display: swap;
src: local("Lato"), url("./fonts/lato/lato-v17-latin-900.woff") format("woff"), url("./fonts/lato/lato-v17-latin-900.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: italic;
font-weight: 900;
font-display: swap;
src: local("Lato"), url("./fonts/lato/lato-v17-latin-900italic.woff") format("woff"), url("./fonts/lato/lato-v17-latin-900italic.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: normal;
font-weight: 700;
font-display: swap;
src: local("Lato"), url("./fonts/lato/lato-v17-latin-700.woff") format("woff"), url("./fonts/lato/lato-v17-latin-700.woff2") format("woff2");
}
@font-face {
font-family: "Lato";
font-style: italic;
font-weight: 700;
font-display: swap;
src: local("Lato"), url("./fonts/lato/lato-v17-latin-700italic.woff") format("woff"), url("./fonts/lato/lato-v17-latin-700italic.woff2") format("woff2");
}
{
"sass": {
"compiler": "dart-sass/1.32.12",
"extensions": {},
"syntax": "SCSS",
"outputStyle": "expanded"
},
"autoprefixer": false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment