9

Everything looks fine on the site, but those two errors are showing up in the console. If I hit the url the font downloads. Been trying to track this down for a while, but I am getting two errors in the console:

Failed to load resource resource:/font/fontawesome-webfont.woff?v=3.0.1
Failed to load resource resource:/font/fontawesome-webfont.ttf?v=3.0.1

How can I get rid of this error?

enter image description here enter image description here

Nix
  • 57,072
  • 29
  • 149
  • 198
  • Can you add the snippet from the css that includes the font urls? – codelark Mar 14 '13 at 20:23
  • I think your browser is showing the content-type warnings as errors instead of warnings. I put together a quick test app and all is working appropriately, but without `ResourceMappers` to set the content-type I get warnings for the fonts. With the mappers, I get no errors. – codelark Mar 14 '13 at 20:27
  • I originally had a content type warning `Resource interpreted as Font but transferred with MIME type application/octet-stream’` as well as 2 errors, but i fixed the warning and the errors remain. – Nix Mar 14 '13 at 20:33
  • How did you fix the warnings? With `ResourceMappers` or something else? – codelark Mar 14 '13 at 20:41
  • Check this: http://stackoverflow.com/q/11052398/114029 – Leniel Maccaferri Jun 18 '13 at 20:53

4 Answers4

4

I recently encountered and solved this problem. The solution is to add the 'font' directory, and any other directories you want resources to be processed to your adhoc includes, so it ends up looking something like this in config.groovy (add directories as needed if you have resources elsewhere).

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

More detail here: URLs within CSS files broken with Grails resources plugin 1.2.7

Community
  • 1
  • 1
Peter
  • 29,498
  • 21
  • 89
  • 122
1

The resource: prefix is an intermediary step in the grails resource plugin's css rewriting process. You appear to be tripping over a bug in either the ad-hoc resource processor or in the css rewriter.

I made an example application (grails 2.1.1, font-awesome 3.0.2, grails-resources 1.1.6) which upon initial load shows no errors. After modifying the font-awesome.css with the application running, the rewriter then throws errors and leaves the broken resource: urls in place.

If I perform the same request with ?_debugResources=true the errors then disappear again.

In my sample's case, leaving the font-awesome files alone after deployment OR using the font-awesome-resources plugin prevented the errors from showing up.

codelark
  • 12,254
  • 1
  • 45
  • 49
1

I had the same issue.

Try using-

src:url(asset-path('fontawesome-webfont.eot?v=3.2.1', font));

instead of a direct static path.

It worked for me on clearing up those specific errors.

Igor
  • 33,276
  • 14
  • 79
  • 112
-1

This is problem of ?v=3.0.1 change your file name and refrence as well. it will work fine. use only fontawesome-webfont.woff & fontawesome-webfont.ttf file name