0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Laravel mixでgoogle fontsが適用されなかった

Posted at

Laravel mixでgoogle fontsを使うときにapp.scssにこう書くと

resources/sass/app.scss
@import url('https://fonts.googleapis.com/css2?family=M+PLUS+1p:wght@100;300;500&display=swap');

ビルドされた時に「;」で改行されて、cssで読み込まれなくなる
public/css/app.css
@import url(https://fonts.googleapis.com/css2?family=M+PLUS+1p:wght@100;

300;500&display=swap);@charset "UTF-8";

なので「@100」とかのサイズ指定をやめてこう書くと読み込まれる
resources/sass/app.scss
@import url('https://fonts.googleapis.com/css2?family=M+PLUS+1p&display=swap');

デメリットとして100みたいな指定ができなくなる。
font-size: 100; #使えない
font-size: 1rem; #使える

もちろん通常通りに、HTMLにlinkとして読み込む分には普通に使える
<link href="https://fonts.googleapis.com/css2?family=M+PLUS+1p:wght@100;300;500&display=swap" rel="stylesheet">
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?