-rh6aa
Last Updated: February 25, 2016
·
946
· nhoizey
9aa2aa68144b2781ac025a29c83bbdd4

Toggle @media between screen and print

It is quite annoying that currently no browser or even extension/plugin let us easily test print CSS styles, without having to generate PDF previews.

Chrome Canary already has a clean way to emulate the printer in the browser, but not everyone uses it, so here is a quick way to toggle your CSS files between screen and print in all @media rules:

#!/bin/sh
rpl -x'.css' -R "@media screen" "@media temp" *
rpl -x'.css' -pR "@media print" "@media screen" *
rpl -x'.css' -pR "@media temp" "@media print" *
Say Thanks
Respond