Skip to content

Instantly share code, notes, and snippets.

@MThakkar121
Created July 31, 2019 10:57
Show Gist options
  • Save MThakkar121/072648888e676d91b3b050a356aff343 to your computer and use it in GitHub Desktop.
Save MThakkar121/072648888e676d91b3b050a356aff343 to your computer and use it in GitHub Desktop.
Special functions in Sass
$roboto-font-path: "../fonts/roboto"
@font-face
// This is parsed as a normal function call that takes a quoted string.
src: url("#{$roboto-font-path}/Roboto-Thin.woff2") format("woff2")
font-family: "Roboto"
font-weight: 100
@font-face
// This is parsed as a normal function call that takes an arithmetic
// expression.
src: url($roboto-font-path + "/Roboto-Light.woff2") format("woff2")
font-family: "Roboto"
font-weight: 300
@font-face
// This is parsed as an interpolated special function.
src: url(#{$roboto-font-path}/Roboto-Regular.woff2) format("woff2")
font-family: "Roboto"
font-weight: 400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment