majodev / google-webfonts-helper

A Hassle-Free Way to Self-Host Google Fonts. Get eot, ttf, svg, woff and woff2 files + CSS snippets
https://gwfh.mranftl.com
MIT License
12.03k stars 421 forks source link

Add possibility to choose between local CSS folder prefix and remote url #26

Closed yukoff closed 7 years ago

yukoff commented 7 years ago

Hi,

Sometimes it is useful to use remote url instead of downloading fonts locally, so with the option set to use remote url CSS snippet would be generated to something like

/* merriweather-300 - cyrillic-ext */
@font-face {
  font-family: 'Merriweather';
  font-style: normal;
  font-weight: 300;
  src: url('//fonts.gstatic.com/s/merriweather/v13/ZvcMqxEwPfh2qDWBPxn6nrR_0bxNg2oCMKP8--GWw48.eot'); /* IE9 Compat Modes */
  src: local('Merriweather Light'), local('Merriweather-Light'),
       url('//fonts.gstatic.com/s/merriweather/v13/ZvcMqxEwPfh2qDWBPxn6nrR_0bxNg2oCMKP8--GWw48.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('//fonts.gstatic.com/s/merriweather/v13/ZvcMqxEwPfh2qDWBPxn6ni-KWXw7CoiyPmiAwGgQ-pk.woff2') format('woff2'), /* Super Modern Browsers */
       url('//fonts.gstatic.com/s/merriweather/v13/ZvcMqxEwPfh2qDWBPxn6ngNLn4qwG1odAuDXh3L2pVg.woff') format('woff'), /* Modern Browsers */
       url('//fonts.gstatic.com/s/merriweather/v13/ZvcMqxEwPfh2qDWBPxn6nu1UYnNJWFGShPLa3frrjI8.ttf') format('truetype'), /* Safari, Android, iOS */
       url('//fonts.gstatic.com/l/font?kit=ZvcMqxEwPfh2qDWBPxn6nt2FN73HCFuf_TNIxcXiPSI&skey=c2b76fd8ebf2629b&v=v13#Merriweather') format('svg'); /* Legacy iOS */
}
...

so CSS code could be selected and used right away without the need to download archive.

davelab6 commented 7 years ago

Do not do this; the fonts.gstatic.com URLs are not guaranteed stable. Only use the CSS API.

majodev commented 7 years ago

As @davelab6 said, I've currently no intention in doing this, especially since it cannot be considered to be stable.