在SASS/Compass中使用Google Web字体 - 如何使用?

Dou*_*ith 3 css sass google-font-api compass-sass

说我有这个字体:打开Sans

如果我想在SASS/Compass项目中使用它,是否有更好的方法,然后链接到由Google托管的其他样式表,以便能够使用该字体?

ste*_*eax 19

使用@import选项:

@import url(http://fonts.googleapis.com/css?family=Open+Sans);
Run Code Online (Sandbox Code Playgroud)

或JavaScript选项:

<script type="text/javascript">
  WebFontConfig = {
    google: { families: [ 'Open+Sans::latin' ] }
  };
  (function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
      '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
  })(); </script>
Run Code Online (Sandbox Code Playgroud)