Title: About HTML Minify
Last modified: June 25, 2019

---

# About HTML Minify

 *  Resolved [morespinach](https://wordpress.org/support/users/morespinach/)
 * (@morespinach)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/about-html-minify/)
 * Love this all-encompassing plugin. We have an issue with HTML minification. In
   our templates, when we use a few spaces inside attributes, which we do for legible
   reading in the source code, we’d like it to be replaced by single spaces in the
   minified version in production. This is how various tools such as Gulp etc work.
   But we’re finding that html minify from Clearfy leaves some specific things alone
   and does *not* minify them. Why?
 * For example, take a look at the page source of the attached URL:
    [https://geislingen.estdocs.com/stories/heading-to-the-free-world/](https://geislingen.estdocs.com/stories/heading-to-the-free-world/)
 * There’s no reason the line breaks here should be line breaks at all. They can
   easily become one space, which would make them a single long line of all HTML.
 * What am I missing? Welcome any pointers. Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fabout-html-minify%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/about-html-minify/#post-11669884)
 * Hi,
 * Can you turn off the minification so I can see what the code looks like in the
   source?
 *  Thread Starter [morespinach](https://wordpress.org/support/users/morespinach/)
 * (@morespinach)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/about-html-minify/#post-11670146)
 * Done now. Please try?
 *  Thread Starter [morespinach](https://wordpress.org/support/users/morespinach/)
 * (@morespinach)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/about-html-minify/#post-11670210)
 * In case it helps, sharing pastebin code..
 * Without minify:
    [https://pastebin.com/tGjhj8T5](https://pastebin.com/tGjhj8T5)
 * After minify:
    [https://pastebin.com/rJYj88QY](https://pastebin.com/rJYj88QY)
 *  [Temyk](https://wordpress.org/support/users/webtemyk/)
 * (@webtemyk)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/about-html-minify/#post-11670606)
 * The Minify component in Clearfy does not cut line breaks inside html tags, as
   this may break the HTML markup.
    You can remove line breaks or leave as is.
 *  Thread Starter [morespinach](https://wordpress.org/support/users/morespinach/)
 * (@morespinach)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/about-html-minify/#post-11670697)
 * Why would it break HTML? There’s nothing in the spec that says removing a newline
   from a tag like this is invalid–
 *     ```
           <a     href='something.com/somepage/somefinalurl'     
   
            target='_blank' 
            data-somecustomvariable='some other value'
           > 
       ```
   
 * This could quite safely be made:
 *     ```
           <a href='something.com/somepage/somefinalurl' target='_blank' 
        data-somecustomvariable='some other value' > 
       ```
   
 * In other words: replace all individual occurrences of “white space” (a space 
   or more, tabs, newline characters) with one space each. This is perfectly valid
   HTML.
 * Happy to be corrected. If clearfy cannot do this I might have to look for another
   plugin to do just this.
    -  This reply was modified 6 years, 11 months ago by [morespinach](https://wordpress.org/support/users/morespinach/).

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘About HTML Minify’ is closed to new replies.

 * ![](https://ps.w.org/clearfy/assets/icon-256x256.gif?rev=2392119)
 * [Clearfy Cache – WordPress optimization plugin, Minify HTML, CSS & JS, Defer](https://wordpress.org/plugins/clearfy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/clearfy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/clearfy/)
 * [Active Topics](https://wordpress.org/support/plugin/clearfy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/clearfy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/clearfy/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [morespinach](https://wordpress.org/support/users/morespinach/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/about-html-minify/#post-11670697)
 * Status: resolved