Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails Serve Static Contents from WebServer from ApplicationResources.groovy

We have a web server for static files (css/js/images). We obtain the war from the Grails command and delete the static web-app contents from application (in build.xml). I thought resources will be redirected to static/js/ or static/css/ but it complains that js/ or /css/ cannot be found.

We don't want to have duplicates under application and web-server. How to force Grails to look at external directory in ApplicationResources.groovy?

The Web server overrides static contents only if files are already present under Application.

like image 215
Rradhak Avatar asked Mar 28 '15 19:03

Rradhak


Video Answer


1 Answers

Use below configuration in Config.groovy:

grails.resources.work.dir = "path/for/static/assets/in/web/server"

Refer the configuration page of resources plugin for details. However, in future, if you decide to migrate to use asset-pipeline plugin instead of resources plugin then use below configuration:

grails.assets.url = "path/for/static/assets/in/web/server"

Refer docs for details.

like image 189
dmahapatro Avatar answered Oct 03 '22 20:10

dmahapatro