Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails 2.3 changes css font-face url to "resource:/..."

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

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

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);
}

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 is prepended to the original URL as well.

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

like image 882
matejk Avatar asked Feb 28 '14 07:02

matejk


People also ask

What attribute is used in changing the font face in CSS formatting text?

In CSS, we use the font-family property to specify the font of a text.

How do I link a font face in HTML?

The HTML <font> face Attribute is used to specify the font family of the text inside <font> element. Attribute Values: It contains single value font_family which is used to specify the font family. Several font family can be used by separating comma. Note: The <font> face attribute is not supported by HTML5.


1 Answers

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

grails.resources.rewrite.css = false

I found the tip how to do that on the Grails mailing list.

like image 190
matejk Avatar answered Oct 06 '22 20:10

matejk