I am beginner in grails.
I would like to add some static resources to grails app and exclude them from url mappings.
I’ve added the following line to UrlMappings groovy:
class UrlMappings {
static excludes = ['/resources/*']
...
But I don’t know how add resources to app and to the final war. Probably there is settings in build.gradle.
I want to open static html which can use static js/css/images.
Like this: localhost:8080/resources/index.html
Thanks in advance
Since Grails 2.4, static assets are managed by the Asset Pipeline plugin. It's well documented, but it amounts to placing static content in either:
Then pull them into your GSP view with the <asset>
tag:
<asset:javascript src="something.js"/>
<asset:stylesheet src="something.css"/>
<asset:image src="something.png" width="200" height="200"/>
It's quite easy, just read the documentation.