Page MenuHomePhabricator

Add printable support to CSS
ClosedPublic

Authored by epriestley on Oct 19 2013, 8:54 PM.
Tags
None
Referenced Files
F15528600: D7363.id16579.diff
Tue, Apr 22, 12:15 PM
F15527763: D7363.id.diff
Tue, Apr 22, 6:25 AM
F15513453: D7363.id.diff
Thu, Apr 17, 7:11 PM
F15445483: D7363.diff
Thu, Mar 27, 2:10 PM
F15399034: D7363.id.diff
Mar 17 2025, 2:32 AM
F15389969: D7363.id.diff
Mar 15 2025, 5:48 AM
F15388231: D7363.id16579.diff
Mar 15 2025, 3:30 AM
F15384179: D7363.diff
Mar 14 2025, 7:02 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