I’m new to grails, I can’t find a good tutorial to install bootstrap in grails 3+ (3.1.5), and I can’t get what the plugin “twitter bootstrap plugin” is exactly for, isn’t it enough to replace layouts/main.gsp with a bootstrap template? is It recommanded to use bootstrap with grails or there is a better alternative? Thank you
EDIT :
The correct answer is the one given by Jeff Scott Brown in comment
“If you are using Grails 3, Bootstrap is installed in a newly created app by default. You don’t have to install it.”
2
Answers
You can install Bootstrap of normal way, ie, adding manually the bootstrap files in your project, in your web-app directory. Then, you only have to add it to layouts or pages (.gsp).
Also, you can add it manually in assets directory. With this way, you only type once time in your layout the load with: g:asset.
Or if you prefer to use the plugin, here a spanish tutorial: http://abel-olguin.com/anadir-twitter-bootstrap-a-grails-3/
BASICS
Boostrap can be added to you project just by adding the files (one css and one javascript) to your html pages. As you will need to include those files in all the pages, I suggest putting the files in the layout files.
BOOTSTRAP
You are using bootstrap by giving specific class names to your
div
s. Bootstrap just adds their specific css to make it neat and responsive. You can read more about it all here.INCLUDING
To add those files, you need to add this to your html layout or just one page:
You can also download the files and prevent from losing the functionality offline. Then download it from here
EXTRA INFO
In case you are not familiar with grails layouts, you can check them out in this link
It’s very simple actually. You just define all the
head
stuff in there.