开发者

Using Google Font API in Google Web Toolkit

开发者 https://www.devze.com 2023-03-09 02:52 出处:网络
Are there any best practices for using Google Web Fonts in a Google Web Toolkit application? My initial inclination is to simply add the css reference directly in my .html file, a la

Are there any best practices for using Google Web Fonts in a Google Web Toolkit application? My initial inclination is to simply add the css reference directly in my .html file, a la

<link href='http://fonts.googlea开发者_运维百科pis.com/css?family=Josefin+Sans:light,regular,bold' rel='stylesheet' type='text/css'>

But I'm not sure if this is the best way to do it. Is there any advantage to (or any way to) use ClientBundle here?


Google discourages the direct inclusion of css files on host pages for a mere fact that in this case GWT code has an external (detached) dependence. This only matters if you share a GWT module with other developers - note that this might happen in the future when your project gets refactored by some other people that took over the development. So it's still a good practice to make GWT modules with type-safe external dependencies.

As you know you can simply use one of the recommended ways:

  • Using a CssResource contained within a ClientBundle.
  • Using an inline <ui:style src="http://fonts.googleapis.com/css?family=Josefin"> element in a UiBinder template.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号