Using Bootstrap theme

Events happening in the community are now at Drupal community events on www.drupal.org.
frost's picture

Hi all,
Just trying out the Bootstrap theme ( https://www.drupal.org/project/bootstrap ) and would appreciate a sense-check on the best practice for working with Bootstrap in Drupal.

I'm trying to make use of Bootstrap's own page layout CSS by adding in the HTML classes it expects to see rather than doing any layout changes directly. I've done this by overriding a few TPL files to inject the classes that Bootstrap expects to see.

This works, but my concern is that by overriding TPLs, I wont get any changes when updating to later versions of the modules where the TPLs originate from. Also I want to check that there isn't an easier approach !

Thanks for any thoughts on this!
Mike

Comments

Haven't actually used

nick.morahan's picture

Haven't actually used Bootstrap on any actual projects, but I was messing around with it a few weeks ago. If I remember rightly there are two methods you can use, one which uses a Bootswatch theme that you choose through a CDN and the other, where you compile LESS files.

This might be helpful:
http://www.webwash.net/tutorials/how-use-bootswatch-themes-drupal-7

im just using the CDN

frost's picture

im just using the CDN approach for now, but that tutorial looks good, I'm going to give it a try, thanks!

Hi Mike One alternative to

gavin.hughes's picture

Hi Mike

One alternative to overriding a large bunch of tpl files to achieve the desired markup & adding classes would be to use some or all of these modules depending on your requirements:

Display suite https://www.drupal.org/project/ds
Field group https://www.drupal.org/project/field_group
Panels https://www.drupal.org/project/panels
Semantic Views https://www.drupal.org/project/semanticviews

Fences https://www.drupal.org/project/fences

There is a good session from Drupal Camp London awhile back see this post and watch his video https://www.codeenigma.com/community/blog/death-themer

Good luck hope that helps!

Gavin Thanks for those, yes I

frost's picture

Gavin
Thanks for those, yes I am already using views_bootstrap and have looked at some of the others. I'm going to watch the death-themer video. His approach looks pretty radical but possibly useful -- ie, getting rid of ALL of Drupal's html/css and allowing a themer to specify exactly what shhould be there. I sometimes work with designers who dont know Drupal so I think there might be some useful stuff in this, thanks!
Mike

If I understood you currectly...

roy_k's picture

If I fully understood you currectly, you dont have to deal with tpl.
Bootstrap comes with a sub-theme ready for drupal with the tpl needed, you don
t need to enter the bootstrap classes (unless you want to change them from the default value).

Here is a link (I saved it to my bookmark toolbar for easy access) to get you started with bootstrap drupal:
https://www.drupal.org/node/1978010

Hope it helped you

Yes Im already using a

frost's picture

Yes Im already using a subtheme, my issue was that I wanted to use as much of Bootstrap's own layout stuff as possible. So in a siimple example I had a block which was created from views exposed fields, and I wanted the form made up of the exposed fields to be centred. I could do that with CSS directly, but to use the bootstrap way of doing it, I had to add the center-block class to the form. I did that with a tpl tweak, but I imagine I couldve done it with javascript or maybe theres a better way?

Simple practice - best practice

roy_k's picture

I understand what you mean, I also think that there are too many tags and classes in drupal and most of them useless.

There maybe a better or easier way to do it but at the moment I do it the same way, adding the bootstrap class I need/want to the html tag.

If you want to use a powerful tool, you can use sass with bootstrap.
Personally I didn`t have the chance to play with it yet, but I heard and saw wonders with it.

Ireland

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: