In Grails latest version, it provides static assets management mechanism. You can use different files under the corresponding folders.
All the images will go under the images directory, js files go under the javascripts directory and CSS goes under the stylesheets directory. These files will be accessed by the URL path start with "/assets/".
Now, what if you don't want to use this structure or need to use the root path for some static file content.
For this, grails provide another option to manage static resources. So, what you can do is create the /resources/public directory under /src/main/ and use static resources there.
For example, if you had a file under /src/main/resources/public/images/example.jpg path then you can access that file using https://example.com/static/images/example.jpg.
This means, your file can be accessed with "/static/" URL by default.If you want to access the file in the app root directory, setup the following configuration under application.groovy
grails.resources.pattern = '/**'
0 comments:
New comments are not allowed.