Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
bedlamIt'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():
* 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.
Comment #2
nd987 CreditAttribution: nd987 commentedIn 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().
Comment #3
bedlamFixed in dev. Thanks for taking the time to report & discuss.
New stable version forthcoming in a day or two.
Comment #4
bedlamFixed and closed.