I'm wanting to minify all the html code on my website theme files but want to be able to un-minify them when I need to edit them.
Similar to how www.cleancss.com allows you to minify CSS code then make is easily readable (un-minify) the code as well. Is there a site or program that will do the same thing but for html code?
If you type 'HTML compress" into Google you'll get pages of sites that provide the facility for minifying your HTML.
If you type 'html tidy' into Google you'll get pages of sites that can un-minify your compressed HTML..
How about you be a good fella and post one of those "pages of sites" that offer the functionality I'm looking for.
Finding a site that will compress HTML is no issue, but one that will compress and un-compress seems to be an issue. Go ahead, be a good fella and post that link.
The first site listed for each in Google is:
Minify - http://htmlcompressor.com/
Unminify - http://infohound.net/tidy/
but want to be able to un-minify them when I need to edit them.
Most of us keep un-minified files laying around our development area, and each time we make an edit, a new minified version (what the web site actually uses) is saved.
This means you're only ever going from normal-> minified, and not back again.
Why does it matter? Only matters if you're picky about spacing. I do try to keep required spacing inside tags, for example the space after label text before the input, so i don't get
(you can style in a space with CSS but for example in a screen reader you could get them all run together depending on settings, or when copy-pasting). If I can put the space inside the tag, that's easier.
Another place is when I use display: inline-block, where I'd like it decided on my end whether there's space between those elements or not, since that matters and cannot easily be CSS'd out. I know what'll happen if I normal->minify, but then un-minifying would likely depend on the un-minifyer.
As Poes says, you're probably better off having an unminified version on your PC that you work on, then when you have made some changes that you want to publish, minify the files in question and upload them.
That way you don't need an un-minifier.
As for compressing your HTML in the first place, this would be a great task for Grunt.
This topic is now closed. New replies are no longer allowed.