• Resolved raghavendra89

    (@raghavendra89)


    Is there a filter for modifying aggregated css?

    I would like to add “font-display:swap;” to all @font-face declarations. Is there a filter before you save the cached css file? I tried this filter: “autoptimize_css_after_minify”, but it is not working.

    Thanks for the help,

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

    (@optimizingmatters)

    there sure is; autoptimize_css_after_minify

    have fun 🙂
    frank

    Thread Starter raghavendra89

    (@raghavendra89)

    yes, it works thanks.

    And I got rid of Google warning: “Ensure text remains visible during webfont load”.

    function cstm_add_font_display_property($css)
    {
        return str_replace('@font-face{', '@font-face{font-display:swap;', $css);
    }
    add_filter( 'autoptimize_css_after_minify', 'cstm_add_font_display_property', 10, 1 );
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    great job raghavendra89 ! 🙂

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

The topic ‘Filter for modifying aggregated css’ is closed to new replies.