Great work on this theme. I am using it as a base theme and here are a few things I encountered with the latest changes from the 2.x branch and twitter_bootstrap_ui.

After switching to use twitter_bootstrap_ui, the sub theme would not load the bootstrap js and css files, giving off a file_get_contents "failed to open stream" error. It was trying to load them from the active sub theme, when it needed to still load them from the twitter_bootstrap base theme.

Here's a patch that with a few changes.

1) Adds global $base_theme_info, which I use to check if there is a base them and use that info to create a path to the bootstrap files.

3) The $files variable in line 66 of template.php was only outputting the javascript files. This was throwing an error about missing files. So I added array_merge to combine $css and $js there.

2) I also added an include for /includes/modules/menu.inc, since _twitter_bootstrap_local_tasks was being called.

CommentFileSizeAuthor
load-tb-files-with-subtheme.patch1.13 KBsquiggy

Comments

Docc’s picture

Status: Needs review » Closed (works as designed)

Believe it or not. This is by design.
If your create a subtheme you should put the bootstrap files in there. This way every theme can have its own files.

If you want one library i suggest using the twitter bootstrap ui module wich has support for the libraries module.

squiggy’s picture

Category: bug » feature
Status: Active » Closed (works as designed)

Thank you for explaining.

I still think it would be a good idea to allow a sub theme to pick up css and js files from twitter_boostrap. It is a feature of the theme system to be able to override the base theme's JS and CSS files from a sub theme's .info file. That is what most themers would expect. I think it makes sense to use the twitter_bootstrap_ui + libraries as an alternative to putting the JS/CSS files in the theme.

squiggy’s picture

Status: Closed (works as designed) » Active

Reopening. Hope that's cool. Also, I realize some additional work will have to be done. What specifically was the reason to not use the .info file to override bootstrap css and js files in a sub theme?

gagarine’s picture

Category: feature » bug

I change that as a bug because is not how Drupal themes are supose to work. How say in #3 subtheme can overrhide css and js in the .info if needed.

gagarine’s picture

Title: Bootstrap css and js files do not load when used as base theme » css and js files need to be in the theme.info file
Category: feature » bug
Status: Closed (works as designed) » Active

See https://drupal.org/node/171205. And you have to link on the not minimised files so devloper can choose when they want to compress css/js files.

A cool thing would be to link on a main less css than import the bootstrap library. So we can take advantage of less (using the less module to complile the file).

nagiek’s picture

Slight hijack of thread, since we're talking about sub-theming.

How is everyone dealing with the include files? Don't get me wrong, I like how easy it is to stay organized. My subtheme however, does not automatically detect these files.

Is there another change to the .info file to ease this?

gagarine’s picture

Assigned: Unassigned » gagarine

Agree I'm responsible for the hijack ;) ... but the .info is the correct way to go and it will solve the problem of the subtheme. I will propose a patch asap, the modifications are very simple in fact. The only things i need to check is how to keep the integration with the library module (I personally don't use it, so I didn't code this part yet).

nagiek’s picture

Oh sorry, I meant I was hijacking the thread. I like the idea of using LESS, since Twitter Bootstrap explicitly ships with it.

I was just reading #1441762: Support LESS. I think making a custom bootstrap.min.css is the way to go. That way you can use all the variables that ship with Twitter Bootstrap already.

Docc’s picture

Assigned: gagarine » Docc
Status: Active » Needs review

Agreed, css/js files should be included through the info file.
Commited to dev, wich includes the non minified files.

gagarine’s picture

the commit for reference http://drupalcode.org/project/twitter_bootstrap.git/commit/8c315f8. For me it looks all right.

gagarine’s picture

Status: Needs review » Fixed

If its committed we have to mark that as fixed. But FYI I try it and it works.

frankbaele’s picture

can we close this one?

gagarine’s picture

Status: Fixed » Closed (fixed)

Yes it's automatic after 2 weeks in fixed.

andregriffin’s picture

Project: Twitter's Bootstrap » Bootstrap