0
votes

I'm using the GSP Resources plugin (http://grails.org/plugin/gsp-resources) to allow me to use GSP tags inside my css files. However, I'm getting a weird error when using the "resource" tag. Here's the line causing the problem:

background: transparent url(${resource(dir: 'static/images', file: 'servererror.png')}) 0.5em 50% no-repeat;

I get the following two errors on application start up:

2014-01-21 09:39:03,608 [FileSystemWatcher: files=#248 cl=groovy.lang.GroovyClassLoader@484b2882] ERROR resource.ResourceMeta - Resource not found: /static/images/servererror.png Error

2014-01-21 09:39:04,257 [FileSystemWatcher: files=#248 cl=groovy.lang.GroovyClassLoader@484b2882] ERROR resource.ResourceMeta - While processing /css/servererror.css, a resource was required but not found: /static/images/servererror.png

The resource is there. If I manually type in the path I can access it no problem. If I move the line causing the problem to the "html" gsp file it works. However, since Grails can't find it, it doesn't put in the path correctly in the css file.

Any help is highly appreciated.

1
Do you have a folder called static? I think that you wanted to use ${resource(dir: 'images', file: 'servererror.png')} - user800014

1 Answers

0
votes

Your best shot will be to manually type the path in the css file. The reason for the error is that, the resource is not able to process the resource tags in the css.

You can inject the css file using the Applicationresource.groovy in the conf folder.

grails-app/conf/applicationresources.groovy

modules = {
    application {
        resource url:'css/servererror.css'
    }
}