Page MenuHomePhabricator

Add printable support to CSS
ClosedPublic

Authored by epriestley on Oct 19 2013, 8:54 PM.
Tags
None
Referenced Files
F19003647: D7363.diff
Nov 21 2025, 9:23 AM
F18819827: D7363.id.diff
Oct 22 2025, 10:03 AM
F18816078: D7363.diff
Oct 21 2025, 4:51 AM
F18808894: D7363.diff
Oct 19 2025, 9:34 AM
F18646109: D7363.diff
Sep 19 2025, 9:29 AM
F18630158: D7363.diff
Sep 16 2025, 10:55 AM
F18594106: D7363.diff
Sep 12 2025, 5:01 PM
F18580423: D7363.id16578.diff
Sep 11 2025, 3:15 AM
Subscribers

Details

Reviewers
btrahan
chad
Maniphest Tasks
Restricted Maniphest Task
Commits
Restricted Diffusion Commit
rP87ccca32b66f: Add printable support to CSS
Summary

Fixes T2146. This is a really simple approach, you just do:

!print .rule {
  whatever: blah;
}

And it transforms it into:

.printable .rule {
  whatever: blah;
}

@media print {
  .rule {
    whatever: blah;
  }
}

So we end up with these rules twice, but they should compress well and we shouldn't need that many of them, and this fix is way way simpler than all the nonsense I discussed in T2146.

Test Plan
  • Added a unit test.
  • Added a simple rule to throw away the menubar when printing.
  • Checked the latter with /?__print__=1.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped