Sometimes it’s nice to be able to print code.
You know, like on paper, with ink and stuff.
In my last job, one of my assignments was restyling an off-the-shelf customer portal-type website. The company wanted to rebrand the site to match its main website, so they had their design team work up some Photoshop comps.
I was the lucky guy charged with making the designer’s vision a reality.
Sounds straightforward, right?
There was a catch.
I couldn’t touch any of the existing HTML. The devs who built the site chose to lock all of the markup away in compiled binaries. I couldn’t so much as add a single CSS class to even one tag.
I was going to have to work all of my magic with CSS. That made it super critical to understand the existing markup.
The first thing I did when I started working on the project was print out the entire home page–about 10 pages worth–and go through it with a pen and highlighter until I could see exactly how it was structured.
Priting out the markup helped me spot elements in the design that weren’t doable and saved me hours of frustration later on.
So yeah, printing can be pretty useful.
Unfortunately, as everyone knows, you can’t print from Sublime.
Only that’s not really true. There are several plugins that make it possible with a clever workaround.
My favourite so far is ExportHTML.
This plugin allows you to convert the current file to syntax-highlighted HTML, then send it to a web browser for easy printing. (It even opens the print dialog for you… )
This might seem like a clunky workaround, but it actually has some advantages. The plugin is more configurable than a built-in print function would be, allowing you to enable or disable line numbers, for example. You can even specify your own syntax highlighting colour scheme to control how the code prints.
ExportHTML is available in Package Control, and it supports both Sublime Text 2 and 3.