• Resolved Shop-tester

    (@evolinestore)


    Hello,

    Somehow autoptimize seems to work half..? HTML and CSS are both checked still, all is very readable with comments on the page source.
    Keep HTML comments is not checked so I would presume comments not to show.
    Already reinstalled the plugin, resulting in the same.

    Site: evolinestore.com

    Any suggestions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Shop-tester

    (@evolinestore)

    Just installed the Beta 2.4 version, the issue remains.
    Looks like the beta is working fine at this time.
    Tested in several browsers.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Some of the things you’re seeing are to be expected (AO does not minfiy inline JS/ CSS if not aggregated), but I see line-breaks in the HTML source that are unexpected. Could be a plugin conflict, but I wouldn’t worry about that too much to be honest; HTML minification is the least important thing here.

    Groeten uit België!
    frank

    Thread Starter Shop-tester

    (@evolinestore)

    Hello Frank,

    Thanks for your response.

    I’m not really worried 🙂 Just trying to make the homepage as light as possible.
    I see a lot of white spaces and unnecessary remarks that simply add weight. Maybe not much, but every byte is a byte…

    Since this is inline CSS to correct default behavior, we could maybe minify it outside of AO? Then insert the minified CSS instead of the source?
    Any suggestions to that?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I have below code lingering around in a code snippet, maybe give that a try, test thoroughly and tweak where required? 🙂

    function minify_inline_code($htmlIn) {
      	preg_match_all('#<(style|script).*>(.*)</(style|script)>#Usmi',$htmlIn,$code);
      	foreach ($code[0] as $codeIn) {
    		$repl["in"] = $codeIn;
    	  	$repl["out"] = str_replace(array("\r\n", "\n", "\r", "\t"),"",$codeIn);
    	  	$replArr[] = $repl;
    	}
      	foreach ($replArr as $replNow) {
    	  	$htmlIn = str_replace($replNow["in"],$replNow["out"],$htmlIn);
    	}
      	return $htmlIn;
    }
    add_filter('autoptimize_html_after_minify','minify_inline_code');

    Works great, thank you!

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

The topic ‘HTML not optimized CSS still as text.’ is closed to new replies.