Page MenuHomePhabricator

Add printable support to CSS
ClosedPublic

Authored by epriestley on Oct 19 2013, 8:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, May 10, 10:12 AM
Unknown Object (File)
Fri, May 9, 2:54 PM
Unknown Object (File)
Tue, May 6, 9:35 PM
Unknown Object (File)
Sun, Apr 27, 3:07 PM
Unknown Object (File)
Sun, Apr 27, 2:49 AM
Unknown Object (File)
Apr 22 2025, 12:15 PM
Unknown Object (File)
Apr 22 2025, 6:25 AM
Unknown Object (File)
Apr 17 2025, 7:11 PM
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