SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    Lexington, KY
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HTML minify and un-minify

    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?

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,603
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    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..
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    Lexington, KY
    Posts
    437
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    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.

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,603
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by WoodiE55 View Post
    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/
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,233
    Mentioned
    47 Post(s)
    Tagged
    1 Thread(s)
    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
    Nameplaceholdertext_______________

    (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.

  6. #6
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,313
    Mentioned
    178 Post(s)
    Tagged
    9 Thread(s)
    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.
    http://24ways.org/2013/grunt-is-not-weird-and-hard/


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •