Is there a reason the bootstrap stylesheet is only added as screen styles, rather than 'all'? This makes printing sites based on this theme fail spectacularly. If not, on template.php, line 512 and 513, the 'media' param can be set to 'all', and printing works much better.

Comments

bedlam’s picture

Assigned: Unassigned » bedlam
Category: bug » feature

It's currently like that by design, but I'm open to changing it. The reason is that Bootstrap doesn't implement any specific print styles--though a glance through the documentation shows that it copes rather well with printing.

My past experience tells me that it's generally bad to set media="all" on a layout stylesheet since that means the print stylesheet needs to be much longer (i.e. since it typically needs to override the layout part of the main stylesheet).

In the spirit of works-out-of-the-box though, this might be a good idea. I'll give it some thought. Anybody else reading this thread and have an opinion?

In the meantime, I have an easier and more maintainable solution for you than changing template.php. Assuming you're using a child theme—and you should be even if you intend to use the bootstrap stuff unmodified*—you only need to implement a hook in your child theme: hook_css_alter():

/**
 * Implements hook_css_alter().
 *
 * Put this in template.php file in your child theme (and remember to change
 * the 'bootstrapchild' part of the function name to match the name of your
 * theme).
 */
function bootstrapchild_css_alter(&$css) {
  // Be sure the array key shows the right path--if you're not using the libraries
  // module on your site, the path may be different!
  $css['sites/all/libraries/bootstrap/css/bootstrap.css']['media'] = 'all';
} // bootstrapchild_css_alter()

* Always create child themes and override parent theme settings there. That way if the parent theme implements bugfixes or security patches, you can simply upgrade the parent theme and concentrate on your own code.

nd987’s picture

In general, you're right - you'd hate to have to undo all the screen css for printing. In this case, though, I think the benefits > drawbacks, since Bootstrap provides the structure of the site. A grid based site won't print similarly to how it appears on the screen without Bootstrap, requiring the developer to do more plumbing they were looking to avoid by using Bootstrap.

Your hook_css_alter() solution is better than mine, which was to override the css file in hook_preprocess_page().

bedlam’s picture

Status: Active » Fixed

Fixed in dev. Thanks for taking the time to report & discuss.

New stable version forthcoming in a day or two.

bedlam’s picture

Status: Fixed » Closed (fixed)

Fixed and closed.