I haven't done this exact thing, but I've done similar things many times. Not every project has or should have a build process. And unfortunately not all of them even have a command line...
Either setup a trivial build script, or don't do it at all.
EDIT: Clearly HN disagrees with me. Tell me, what does being a cowboy get you here?
If it's a measurable performance boost, then as soon as you patch it again your site will seem slower. Unless you then manually minifiy again. And again. Until you setup a build script.
If it's not a measurable performance boost, (And I doubt that you know either way because if you're not setting up a trivial build script then I highly doubt you're putting in the time to profile) then what do you get? The next person to come along gets to have a harder time debugging because you don't have source maps?
I've used them more than a dozen times. Some sites get the minification just to ramp up a google pagespeed number - not really for the end users - so why bother with a build process?
Write some html, ftp. Then pagespeed numbers matter to some people and in some competitive industries - view source, web minify, ftp. done.
If it's critical to the business needs, script it. If you need to do it every time you fix a bug, make it automatic.
It's my go-to Numberwang encoder!
This list may not be representative of “all free online tools” but is sufficient for the context. Perhaps the common thread amongst all of them is that they are served over the interweb. And I wonder what’s the use case?
Take this input HTML:
<title>This is a title</title>
<!DOCTYPE html><html lang="en-au"><head><meta charset="utf-8"><title>This is a title</title></head><body class="foo"><h1>Well.</h1><p>I wonder…</p></body></html>
Here’s what I say it should have emitted:
<!doctype html><html lang=en-au><meta charset=utf-8><title>This is a title</title><body class=foo><h1>Well.</h1><p>I wonder…
This is absolutely nothing to do with Postel’s law. I believe that Postel’s law is a terrible idea in most places—it leads to a lack of robustness in practice, and all kinds of security problems, because most programmers are frankly not good at their trade. Rather, the HTML spec defines all behaviour—so there is no liberality about it; you’re simply following the spec with no interpretation—which is the only way to write robust protocols and their implementations.
also seems like a terribly brittle externality to add to my life
Check out https://jsonchecker.com/
It validates and formats JSON.
Let me know if you have any feedback!