Swaagie / minimize

Minimize HTML
MIT License
163 stars 18 forks source link

[Issue] Legitimate spacing being removed #17

Closed mikehayesuk closed 10 years ago

mikehayesuk commented 10 years ago

Hey,

Sorry for the onslaught of issues from me... I have noticed one more though.

Spacing is being removed around elements, for example:

<p>Enter your name: <input type="text" name="person_name"> <button>Save</button></p>

Is compiled to:

<p>Enter your name:<input type="text" name="person_name"><button>Save</button></p>

Is this expected behaviour? I often use spacing around form elements (rather than always using CSS to space them apart) and imagine that this is quite common. Of course &nbsp; is an option here but I'm not sure changing the source is the right solution.

Hopefully my last one, sorry! If it improves the software though, it must be a good thing. :)

Thanks

tomByrer commented 10 years ago

Workarounds: <p>Enter your name:&emsp;<input type="text" name="person_name">&emsp;<button>Save</button></p> http://en.wikipedia.org/wiki/Space_%28punctuation%29#Spaces_in_Unicode Or use <span> & margin-right:1em.

Swaagie commented 10 years ago

This one is rather tricky, as the input element per se is not seen as an element having to pertain flow, like pre and code. Next week I'll be on vacation and perhaps a solution will come to mind. I'll think about it. I could perhaps provide an option to allow this pattern

mikehayesuk commented 10 years ago

One option would be to reduce any kind of whitespace to just one single space. This minifies the HTML but retains spaces where necessary, it also matches the behaviour of the browser. Probably best as an option, as I'm sure some people will want the spacing removed completely. Thanks and have a great vacation!

Swaagie commented 10 years ago

Fixed with https://github.com/Moveo/minimize/commit/f4d77609d7f12eb7deba7c791654b34e64d07c32, released as 0.8