I Created conditional SCSS function for return single or multiple font urls.
And my compiled css looking without errors. So i seems the function is working well.
But when press F5 to debug, in the console giving an error (in nodejs app)
error: error reading values after
After the error my site is looking bad. So i opened css file in my site using developer tools, in the css file looking like this
error reading values after
1
Error: error reading values after
It seems css file doesn't compiled. But locally i opened it, then looking well
@font-face {
font-family: "Sansation_Regular";
src: url("../fonts/Sansation_Regular.ttf"), url("../fonts/Sansation_Regular.eot"), url("../fonts/Sansation_Regular.woff"), url("../fonts/Sansation_Regular.svg");
font-weight: normal;
font-style: normal;
}
If my function have problems help to solve.
Here My SCSS Function
@function urls($url, $multiple) {
$result: ();
// base url
$fontsBaseURL: '../fonts/';
@if $multiple == true {
$ext: "url(" + $fontsBaseURL + $url + ".ttf)" + ",",
"url(" + $fontsBaseURL + $url + ".eot)" + ",",
"url(" + $fontsBaseURL + $url + ".woff)" + ",",
"url(" + $fontsBaseURL + $url + ".svg)";
@each $item in $ext {
$result: append($result, $item);
}
@return $result;
} @else {
@return url($fontsBaseURL + $url + .ttf);
}
}
And Helper @mixin
Function
@mixin Font($family, $src-name, $multiple) {
$url: urls($src-name, $multiple);
font-family: $family;
src: $url;
font-weight: normal;
font-style: normal;
}
Here i called Function
@font-face {
@include Font("Sansation_Regular", "Sansation_Regular", true);
}