skip to Main Content

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


  1. 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/

    Login or Signup to reply.
  2. 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 divs. 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:

    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
    

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search