• The best plugin to speed up your wp website.
    It could be improved in the html optimization.
    Anyway I use it in combination with Minify Html to improve html optimization.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Thank you 🙂

    What could be improved in AO’s HTML optimization?

    Thread Starter Pandasonic2

    (@pandasonic2)

    Minify Html (plugins/minify-html-markup/) has a very useful feature, it removes trailing slashes and is very useful to W3C actual standards validations. It even compresses more the code.
    $buffer = str_replace( ' />', '>', $buffer );

    I think is very easy to introduce this feature in Autoptimize. Let me know if you do it.

    • This reply was modified 3 years, 5 months ago by Pandasonic2.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    ah, those trailing slashes, someone else asked about those as well. If you want I can provide you with a code snippet to make this happen in AO as well?

    But I’ll put the feature on the backlog for later consideration 🙂

    Thread Starter Pandasonic2

    (@pandasonic2)

    Yes, I’d like. It’s always better to reduce the number of plugins installed, so I’ll remove the other one. Thank you.

    • This reply was modified 3 years, 5 months ago by Pandasonic2.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, this code snippet (untested!) should work;

    
    add_filter( 'autoptimize_html_after_minify',
        function( $html ) {
            return str_replace( ' />', '>', $html );
        }
    );
    Thread Starter Pandasonic2

    (@pandasonic2)

    I tried the code locally and seems to be ok. I only had to deactivate lazy loading in perfmatters and move to lazy load in autoptimize. At difference than minify html the snippet doesn’t change perfmatters code in images.
    I added some other changes in html code to validate in W3C because WP in “class-wp-styles” and “class-wp-scripts” respectively adds “text/css” and “text/javascript”.

    add_filter( ‘autoptimize_html_after_minify’,
    function( $html ) {
    return str_replace( ‘ />’, ‘>’, $html );
    return str_replace( ‘type=\’text/javascript\”, ”, $html );
    return str_replace( ‘type=\’text/css\”, ”, $html );
    return str_replace( ‘/>’, ‘>’, $html );
    }
    );

    • This reply was modified 3 years, 5 months ago by Pandasonic2.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    once you return everything after it won’t get executed, so maybe use something like this instead?

    add_filter( 'autoptimize_html_after_minify',
      function( $html ) {
        $html = str_replace( ' />', '>', $html );
        $html = str_replace( ‘type=\’text/javascript\'', '', $html );
        $html = str_replace( ‘type=\’text/css\'', '', $html );
        return $html;
      }
    );
Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Impressive!’ is closed to new replies.