Grails 2.3 changes css font-face url to “resource:/…”

前端 未结 2 1447
情书的邮戳
情书的邮戳 2021-01-04 20:36

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

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

T

相关标签:
2条回答
  • 2021-01-04 21:01

    A better solution I think is proposed by dmahapatro at: https://stackoverflow.com/a/22849288/2286664

    You need to ensure your font files are known to the Resources plugin.

    The following worked for me in my Config.groovy, adapt it based on your paths:

    grails.resources.adhoc.includes = [
        '/images/**', '/css/**', '/js/**', '/img/**', '/fonts/**'
    ]
    

    You'll needed to run grails clean after making this change.

    0 讨论(0)
  • 2021-01-04 21:06

    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.

    0 讨论(0)
提交回复
热议问题