This project is archived and is in readonly mode.

#5123 ✓invalid

stylesheet_link_tag media default

Reported by tgrayson | July 15th, 2010 @ 03:27 PM

the default value for the media type in stylesheet_link_tag includes is 'screen'. It seems that there is no way to configure this option, and that leads to a lot of rails apps online being completely devoid of stylesheets in printing and other media. Should the default include printing? If not, shouldn't you be able to config the default in the environment?

Comments and changes to this ticket

  • Marjan Krekoten'

    Marjan Krekoten' September 16th, 2010 @ 01:49 PM

    Did you try :media option?

    stylesheet_link_tag "style", :media => "print"
  • Lake

    Lake September 16th, 2010 @ 11:11 PM

    I agree with Marjan. You can pass the "media" option to set it to print.

  • Lake

    Lake September 16th, 2010 @ 11:14 PM

    • Tag set to invalid
  • Rohit Arondekar

    Rohit Arondekar September 17th, 2010 @ 01:50 AM

    • State changed from “new” to “invalid”
    • Importance changed from “” to “Low”
  • tgrayson

    tgrayson September 17th, 2010 @ 03:57 PM

    I wholly understand what you guys are saying, and I entirely agree with you. If I want to add a print only style sheet to MY website, I can use the :media => "print". I do, that's good. What I'm claiming is an issue, is that other people don't know this, or expect this. Since :media isn't set to ALL by default, the entire community is afflicted with bad experiences in non desktop media by default. For example. Look on in the "Who is already on rails?" section. The poster children of rails. Print any of those sites, aside from Yellowpages. Shopify, Groupon, github, twitter, basecamp all fall apart if you try to print them.

    Now, I know I can't prove what their code is without looking at it, but I've noticed this across many other rails sites. I'd wager to say that all 5 of these websites didn't intentionally set their media to screen intentionally, ensuring that printing their webpages would be unstyled procedural HTML. They are probably just doing a standard include, which specifies screen, instead of all, so: printing, projection, and the rest of the lot are not considered.

    Does this make more sense?

    I think by default, people would like to have their prints look like their webpage, rather than be unstyled.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>