简体   繁体   中英

Grails Asset Pipeline @font-face src url

I just started a new Grails project (Grails v2.4.2) and it is my first time using the Asset Pipeline plugin. I managed to get it working without much issue until I noticed the fonts were not displaying correctly.

I figured that the issue was the @font-face url in the css did not have the correct path. The only way that I could get it to work was to put the full path to the files into the css which was, for example:

src: url('/ProjectName/assets/fontawesome-webfont.eot');

The font files are all in the grails-app/assets/fonts folder and the css files are in the grails-app/assets/stylesheet folders.

Is there a better way to reference the font files from the css?

The issue for me was caused by a bug in the version of the Asset plugin that was bundled with Grails 2.4.2. This error will only show up for people using Windows PC's

Illegal character in path at index 0: \\/../

Once I went from asset-pipeline:1.9.4 to asset-pipeline:1.9.6 the error went away

The error is discussed here:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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