• Resolved jumbo

    (@jumbo)


    Again, thanks for your great plugin.

    When I enable “Minify HTML” in basic settings, it has no effect. HTML is not minified. However, when I enable that setting and “Optimize HTML via Dom Parser – Improves HTML minification efficiency.” then minification works, but the HTML seems a bit off when using the DOM parser.

    For instance, the closing </body> and </html> tag are removed. I’d prefer the non-DOM parser implementation anyway (at least to compare against).

    BTW, whichever minify method is used, could you please append the HTML powered by comment at the end so that it’s possible to tell if Powered Cache’s caching is active on that page. Maybe a more concise one-liner, like the following:

    </body></html><!-- Cache served by Powered Cache, Last modified: Fri, 03 May 2024 01:57:08 GMT -->

    Testing on Windows dev machine, WordPress 6.5.2, Powered Cache 3.4.4, PHP 8.1.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mustafa Uysal

    (@m_uysl)

    Hi @jumbo,

    When optimizing the output with dom parser, it removes omitted tags – https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission

    BTW, whichever minify method is used, could you please append the HTML powered by comment at the end so that it’s possible to tell if Powered Cache’s caching is active on that page. Maybe a more concise one-liner, like the following:

    I might consider adding that for further versions or disabling the removal of omitted tags, however you can check the header of the request to understand whether it is cached or not cached.

    Thread Starter jumbo

    (@jumbo)

    H @m_uysl,

    Note: I don’t know why this thread was marked as “NSFW” after I posted it.

    Understood about the DOM minification option. I wasn’t planning on using that option. I just wanted to report it at the same time.

    Putting that aside, I want to circle back to my original report of the base “Minify HTML” option alone not having any effect. (I have “Optimize HTML via Dom Parser” disabled in this case.)

    When I compared the HTML source after enabling it that one option, it looked like it had no effect, but after closer inspection, the minification does have a minor effect that I only noticed when I did a line-by-line text comparison.

    For instance, here’s a portion without minification enabled:

    
    <!doctype html>
    <html lang="en-US">
    <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name='robots' content='index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' />
    
    	<meta property="og:locale" content="en_US" />
    	<meta property="og:type" content="website" />

    And here’s where it looks like after powered cache minification is enabled:

    
    <!doctype html><html lang="en-US"><head><meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name='robots' content='index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1'/>
    
    	<meta property="og:locale" content="en_US"/>
    	<meta property="og:type" content="website"/>

    Notice how it:

    • didn’t remove most EOL (new end of line) characters
    • didn’t remove any spaces at the beginning of lines

    Yet it removed the space between the self-closing HTML tags [space]/> to />

    It seems like once it gets to a

    />

    It breaks the processing flow.

    The self-closing tags above are minified throughout the page, mostly in <img /> to <img/> tags. The rest of the document is left untouched and unminified.

    That is until you get to the closing body and html tags, which gets minified:

    Here’s the before, without minification:

    
    </noscript>
    -->
    </body>
    </html>

    And here’s after minification enabled:

    
    </noscript>
    -->
    </body></html>

    In the meantime, I’ve added in the “Minify HTML” plugin to minify output, which works well with Powered Cache, and doesn’t remove the <!-- Cache served by Powered Cache --> string at the end, even though it has an option to remove all other HTML comments (which I’ve enabled).

    Thanks.

    Thread Starter jumbo

    (@jumbo)

    Hi @m_uysl), I just wanted to bump this and reiterate that the main “Minify HTML” setting doesn’t appear to work. I’m not referring to the “Optimize HTML via Dom Parser.” I’m just talking about “Minify HTML” alone.

    I did a fresh WordPress install, installed Powered Cache, then enabled “Minify HTML,” then saved settings. That was the only change. Afterward, no page content is minified.

    Powered Cache is the only active plugin.

    Plugin Author Mustafa Uysal

    (@m_uysl)

    Hi @jumbo,

    Could you try the version 3.4.5?

    > I did a fresh WordPress install, installed Powered Cache, then enabled “Minify HTML,” then saved settings. That was the only change. Afterward, no page content is minified.

    When dom optimization is not enabled, the difference is relatively small. With the new update, the blank spaces will be removed regardless of the setting when HTML minification is enabled.

    Also, omitted tags will not removed when the optimization with the dom parser is enabled, so you can see the cache fingerprint even if you enable that option.

    I hope this helps.

    Thread Starter jumbo

    (@jumbo)

    Hi @m_uysl, it’s working great now. Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[NSFW] Enabling “Minify HTML” has no effect’ is closed to new replies.