Homec4science

Add printable support to CSS

Authored by epriestley <git@epriestley.com> on Oct 19 2013, 23:23.

Description

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.

Reviewers: chad, btrahan

Reviewed By: chad

CC: chad, aran

Maniphest Tasks: T2146

Differential Revision: https://secure.phabricator.com/D7363

Details

Committed
epriestley <git@epriestley.com>Oct 19 2013, 23:23
Pushed
aubortJan 31 2017, 17:16
Parents
rPH3643fe1498f1: Use property tabs in Files
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH87ccca32b66f: Add printable support to CSS (authored by epriestley <git@epriestley.com>).Oct 19 2013, 23:23