GSP Resources Grails plugin
Groovy
Switch branches/tags
Nothing to show
Pull request Compare This branch is 21 commits ahead of pmcneil:master.
Permalink
Failed to load latest commit information.
grails-app
src/groovy/mypackage
test/integration
web-app
GspResourcesGrailsPlugin.groovy
LICENSE.txt
README.markdown
application.properties

README.markdown

#GSP Resource plugin# This plugin allows you to reference GSP-generated files as cacheable static resources. Consider the following: fibonacci.js.gsp

<%fib = {n -> return n <= 1 ? n : fib(n-1) + fib(n-2)}%>
var fibonacci = [<%=(0..10).collect{ fib.call(it) }.join(',')%>];

which is then cacheable and serveable as a javascript file as

var fibonacci = [0,1,1,2,3,5,8,13,21,34,55];

##Installation##

grails install-plugin gsp-resources

##Usage##

'style' {
    resource url:'css/test.css.gsp',attrs:[rel: 'stylesheet/css', type:'css']
}

##Limitations## Since this plugin is meant to serve static resources, there is no inherent data-watching within GSPs. Changes to a GSP file itself will trigger recompilation, but changes to the data referenced within a GSP will not.

##Special Thanks## Peter McNeil for his work on GSParse, which was the inspiration for this plugin.