Abdul Munim
Abdul Munim

Reputation: 39

How to add download google font in the scss file of react?

@font-face {
      font-family: "roboto";
      font-display: swap;
      font-style: normal;
      font-weight: 400;
      src: local("roboto") url(/public/assets/fonts/roboto.woff2);
}

Error 1: https://i.sstatic.net/rti1W.png

If will add the downloaded font in the scss file of react so compiler will be show this error. What can I do?

Upvotes: 0

Views: 205

Answers (1)

somethinghere
somethinghere

Reputation: 17358

You are missing a semicolon after the font-family declaration:

@font-face {
  font-family: "roboto"; // <-- Here
  font-display: swap;
  font-style: normal;
  font-weight: 400;
  src: local("roboto") url(/public/assets/fonts/roboto.woff2);
}

Which will cause a compiler error for SCSS.

Upvotes: 1

Related Questions