I'm using Grails for a web project for a CSE class in college. I've noticed many of the other groups doing this project are using Bootstrap 4 for the web design (I'm in the only group using Grails). I looked into Bootstrap 4 and I really love the way it looks. Personally I don't like the way Grails looks with standard HTML. I was wondering if there is a way that I can use Bootstrap 4 with Grails. For example in standard HTML I can have a button and forms that will submit data to a controller and some action will happen, it doesn't seem to work the same way with Grails.
Would anyone know if I can integrate Bootstrap 4 with Grails and if so how I can do it?
Bootstrap has nothing to do with Grails. Just include the dependencies and use the bootstrap classes in your GSP just like you'd do in a plain HTML page. You can use the <g:form>
tag to post to your Grails controller.
In your newly created app you will see that under grails-app/assets/stylesheets/
are a number of .css
files including bootstrap.css
and under grails-app/assets/javascripts/
you will find bootstrap.js
. We put those there by default and many people use them, but you don't have to. Drop whatever assets you like in those folders and then you can use them. You may want to edit grails-app/assets/javascripts/application.js
and grails-app/assets/stylesheets/application.css
to pull in whatever assets you add to the project and you would do that with the require
directive. See the contents of those files for examples.
I hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With