A lot of people — mostly ones who learned to make Web pages in the late 90s — are fans of what I’ll call the view-source ethos.

Here it is in a nutshell:

I am broadly in favor of this. I’ve thrown out automatic minifiers for my own site. I keep hoping someone notices my exquisitely-arranged path components in my SVGs’ d properties. There’s a knob I could twist to minify my concatenated CSS. I sigh when a personal site ships a nearly-empty HTML page with a compiled JavaScript program to the browser, and the program has a small note tag attached that says “some assembly required”, à la React.

But.

It isn’t 1997 anymore.

The occasional visitor who wants to see how your site is made can easily put in good whitespace. You shouldn’t care about whitespace if you want to ensure your visitors can learn from your website.

Why?

Two reasons:

When I want to see how a site is put together, I don’t do View Source anymore. I inspect an element that looks close to the interesting part of the page and expand my search from there.

DOM inspectors have other benefits over View Source:

Now, suppose you want to actually view the source code of a site. Turns out, I’ve wanted to view the source code of sites recently. This is what I’ve been doing, and it’s fantastic:

curl https://www.frogorbits.com/ | prettier --parser html | bat

Piping to bat only gets me syntax colorizing. If you don’t have bat handy, then just leave off the | bat at the end.

Don’t have curl or prettier handy? Copy the text of the webpage in the View Source window and paste it into https://prettier.io/playground/.

This is way better than View Source ever was.

What you should still avoid

While you don’t need to care about newlines anymore, if you still want your sites to be understandable by newbies, you should still avoid:

Then there are a handful of things that are probably ok, but are still kind of questionable:

Appendix: Downloading and formatting on Windows

If you’re on Windows, try something like this (I haven’t tried it):

Invoke-WebRequest 'https://www.frogorbits.com/' | Set-Clipboard

and then paste the contents of your clipboard into the Prettier playground.