Page MenuHomePhabricator

Add printable support to CSS
ClosedPublic

Authored by epriestley on Oct 19 2013, 8:54 PM.
Tags
None
Referenced Files
F22749984: D7363.id16578.diff
Sun, Oct 4, 8:43 PM
F22647265: D7363.id16579.diff
Wed, Sep 30, 7:04 PM
Unknown Object (File)
Jun 4 2026, 6:43 AM
Unknown Object (File)
Apr 16 2026, 12:16 AM
Unknown Object (File)
Mar 30 2026, 8:34 PM
Unknown Object (File)
Mar 24 2026, 3:52 AM
Unknown Object (File)
Mar 6 2026, 10:20 PM
Unknown Object (File)
Feb 28 2026, 6:16 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