简体   繁体   中英

grails 3.3.0: does it include bootstrap?

When trying to figure out how to get bootstrap into grails 3.3.0, when the plugins supporting this are out of date/unsupported, I noticed that there is already a bootstrap entry in application.css:

*= require bootstrap
*= require grails
*= require main
*= require mobile
*= require_self

In bootsrap.css it says its version 3.3.6.

this seems to be an undocumented feature, and there are a lot of posts on how to get bootstrap into grails 3 which makes no sense if its already there, unless they are trying to figure out how to update the bootstrap version?

In order to see if bootstrap is working, I edited the default main.gsp and added:

<button type="button" class="btn btn-default btn-lg">
  <span class="glyphicon glyphicon-star" aria-hidden="true"></span> Star
</button>

Unfortunately, what is rendered seems broken - where the glyph should be is a square box.

I have tried many other bootstrap examples, and they do not appear to work, ie there are not rendered correctly. I dont know if this is because bootstrap is not working, or if in the bowels of the thousands of lines of CSS which grails produces by default everything is overridden.

Does anyone know of something I could put in main.gps which would show one way or the other if bootstrap is working?

It does only include the bootstrap stylesheet. If you want to use glyph icons, you need to download the glyph font separately.

This you also see in the bootstrap stylesheet, as the fontface refers to not existing lib.

@font-face {
  font-family: 'Glyphicons Halflings';

  src: url('../fonts/glyphicons-halflings-regular.eot');
  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}

I guess that the only included the bootstrap stylesheet, to style the starting "template" where the don't make use of glyph icons.

The complete package of Bootstrap look like this ( http://getbootstrap.com/getting-started/#download ):

bootstrap/
├── css/
│   ├── bootstrap.css
│   ├── bootstrap.css.map
│   ├── bootstrap.min.css
│   ├── bootstrap.min.css.map
│   ├── bootstrap-theme.css
│   ├── bootstrap-theme.css.map
│   ├── bootstrap-theme.min.css
│   └── bootstrap-theme.min.css.map
├── js/
│   ├── bootstrap.js
│   └── bootstrap.min.js
└── fonts/
    ├── glyphicons-halflings-regular.eot
    ├── glyphicons-halflings-regular.svg
    ├── glyphicons-halflings-regular.ttf
    ├── glyphicons-halflings-regular.woff
    └── glyphicons-halflings-regular.woff2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM