Last Updated: February 25, 2016
· nhoizey

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:

rpl -x'.css' -R "@media screen" "@media temp" *
rpl -x'.css' -pR "@media print" "@media screen" *
rpl -x'.css' -pR "@media temp" "@media print" *