#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.