build - Use a different layouts/main.gsp based on environment in Grails -
i trying have 2 distinct layouts application. of changes css based, elements might moved around(such moving navbar top side). decided easiest have 2 main layouts, , pick 1 based on environment compile for.
i reading grails event scripts , how hoop on there. ideally have red_main.gsp , blue_main.gsp , copy 1 of them main.gsp during build time. examples online on limited , appreciate insight.
thank you!
here how did stuck in same boat. scripts/_events.gsp
file:
eventcompilestart = { msg -> def envn = grails.util.environment.current.name def mainname = ""; if( envn.contains("_red" ) ) { mainname = "main_red.gsp" } else { mainname = "main_blue.gsp" } ant.copy(file: "${basedir}/grails-app/views/layouts/${mainname}", tofile: "${basedir}/grails-app/views/layouts/main.gsp", overwrite: true) }
Comments
Post a Comment