Grails 2.3将css font-face url更改为“resource:/...&” [英] Grails 2.3 changes css font-face url to "resource:/..."

查看:117
本文介绍了Grails 2.3将css font-face url更改为“resource:/...&”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的CSS中包含自定义字体,如下所示:

I want to include a custom font in my CSS like this:

@font-face
{
    font-family: TheFont;
    src: url(fonts/SourceSansProLight.ttf);
}

CSS使用Grails 2.3提供,CSS被修改为

The CSS is served with Grails 2.3 and the CSS is modified to become this

@font-face
{
    font-family: TheFont;
    src: url(resource:/css/fonts/fonts/SourceSansProLight.ttf);
}

生成的字体网址方案未知,浏览器无法打开该文件。 Chrome例如报告:

The resulting font url scheme is unknown and browsers can't open that file. Chrome, for example, reports:

GET resource:/css/fonts/fonts/SourceSansProLight.ttf net::ERR_UNKNOWN_URL_SCHEME 

/ css / fonts也在原始网址之前。

/css/fonts is prepended to the original URL as well.

我如何指示Grails完全离开font-face URL?

How can I instruct Grails to leave the font-face URL exactly as it is?

推荐答案

在Config.groovy中禁用CSS处理:

The solution was to disable CSS processing in Config.groovy:

grails.resources.rewrite.css = false

我发现提示如何在 Grails邮寄列表

这篇关于Grails 2.3将css font-face url更改为“resource:/...&”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆