简体   繁体   English

Grunt CSS缩小和谷歌字体

[英]Grunt CSS minify and Google Fonts

I'm encountering a problem : 我遇到了一个问题:

I've set up a better workflow mostly with Bower and Grunt. 我已经建立了一个更好的工作流程,主要是Bower和Grunt。 My problem is that now, after setting up lot of tools to minify, valide, compress, and so on, I have to import a Google Font . 我的问题是,现在, 在设置了大量工具来缩小,修改,压缩等之后,我必须导入一个Google字体

So basically, I can include it like that : <link href='http://fonts.googleapis.com/css?family=Roboto:400,300,500,700|Vollkorn:400italic,400,700|Montserrat:400,700' rel='stylesheet' type='text/css'> 所以基本上,我可以这样包括: <link href='http://fonts.googleapis.com/css?family=Roboto:400,300,500,700|Vollkorn:400italic,400,700|Montserrat:400,700' rel='stylesheet' type='text/css'>

It's the fastest way to import fonts, I guess, but well, it's another CSS file, so another request to the server, when I try to keep it as low as I can. 这是导入字体的最快方法,我想,但是,它是另一个CSS文件,所以当我尽量保持尽可能低时,另一个请求到服务器。

So my question is : Is there any way to import quickly Google fonts in a Grunt managed project (with CSS minification and compression) ? 所以我的问题是:有没有办法在Grunt托管项目中快速导入Google字体(使用CSS缩小和压缩)?

When I say quickly, I mean : without downloading my fonts as a zip, copying it in my project folder, typing @font-face...) 当我快速说出来时,我的意思是:不将我的字体下载为zip,将其复制到我的项目文件夹中,输入@ font-face ...)

Is there a Grunt module that works with google-font-api or something ? 有一个Grunt模块可以与google-font-api一起使用吗?

Any help appreciated :) 任何帮助赞赏:)

I've been looking for the same type of tool to remove the friction of using bootswatch templates while supporting offline mode. 我一直在寻找相同类型的工具来消除使用bootswatch模板时的摩擦,同时支持离线模式。 There is no ready made option that I'm aware of that will automatically parse your css downloading the remote hosted font's and/or following imports like google fonts URLs. 我知道没有现成的选项可以自动解析下载远程托管字体的css和/或谷歌字体URL之类的导入。 However, https://github.com/cgross/grunt-dom-munger gives you the tools you would need to create a customized solution for your project. 但是, https://github.com/cgross/grunt-dom-munger为您提供了为项目创建自定义解决方案所需的工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM