Search code examples
grailsgroovyasset-pipelinegrails-plugingsp

assetPath returns different Urls


I am using Grails 2.4.4 and compile ":asset-pipeline:1.9.9" with compile ":sass-asset-pipeline:1.9.2".

My config.groovy has the following entries:

grails.serverURL = "http://mydomain.no-ip.biz:8080/myapp"
grails.serverName = "mydomain.no-ip.biz"

When I use

${assetPath(src: 'logoSmall.png', absolute: true)} 

on a GSP view I get the following url:

http://mydomain.no-ip.biz:8080/myapp/assets/logoSmall.png

Which is the correct url.

When I render the GSP view in a Service with:

PageRenderer groovyPageRenderer
...

def contents = groovyPageRenderer.render(template: "/pathToMyGSP", model:[])

I the contents view my path becomes:

http://mydomain.no-ip.biz:8080/myappassets/logoSmall.png Note that the / before the assets disappeared. This happens only when I use groovyPageRenderer.render when I use g.render it does not happen.

How do I get the correct asset url?


Solution

  • This bug has been fixed in a more recent version of the asset-pipeline plugin (2.0.21, I think).