I have a grails app that contains a whole mess of individual javascript files in a series of nested directories. I want to manage them via the resources plugin, but don't want to have to explicitly register each one.

Web Dir Structure

webapp app controller controller1.js controller2.js ... model model1.js ... view view1.js

what would be great is to just declare in my AppResources.groovy file:

resource url: 'app/**/*.js'

but that doesn't work -- throws a null pointer. I've tried:

resource url: 'app/**' but with no luck

I've thought that i would put some code in the config file that would recurse through the directory structure, but that doesn't seem to be working. Here's what I've tried:

def iterClos = { it.eachDir( iterClos ); it.eachFile { resource url: ${it.canonicalPath}; } } iterClos( new File("$grails.app.context/app") )

Unfortunately that failed as well.

Does anyone have any ideas how I could achieve this?