mdoTomofumi Chiba
10/2/2024, 11:35:34 AM

How to host Material Icons offline

$ wget https://fonts.googleapis.com/icon?family=Material+Icons --header='user-agent: AppleWebKit/537.36 Chrome/129.0.0.0 ' -O material-icons.css
$ wget $(cat material-icons.css |grep 'url(' |awk -F'[()]' '{print $2}')
$ ls -1
flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2
material-icons.css
$ sed -i 's|https://fonts.gstatic.com/s/materialicons/v[0-9]*/|./|g' material-icons.css
$ cat material-icons.css
/* fallback */
@font-face {
  font-family: 'Material Icons';
  font-style: normal;
  font-weight: 400;
  src: url(./flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}

.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

ref: https://stackoverflow.com/questions/37270835/how-to-host-material-icons-offline

オフラインでホストする方法がメンテされてないっぽい。

TweetLike