Search code examples
groovygrailsgsp

How to customize Grails default CRUD code templates (such as GSP, Controller, Service, and Specification templates) generated by scaffolding?


I have a question that how can I display the controller CRUD default sites with an own stylesheet?

Problem Context

I created a grails application with a controller, domain, and a view and now I created my own stylesheet, own layout, and added some pages. Now I have my new files with my stylesheet but if I use the default function it looks the same:

Default design

So how can I use the CRUD function in the content of my new pages with my style?


Solution

  • The default scaffolding code is generated using the Grails Scaffolding plugin.

    • If it is about the styles only then you could include the stylesheet in the main layout file.
    • Otherwise, I think you could also extend the scaffolding templates using the grails install-templates to add the templates under the src/main/templates/scaffolding which you could customize as per the requirement.

    You may also want to take a look at the Grails scaffolding plugin here