• Resolved nebrekab

    (@nebrekab)


    Hi,

    Thanks for this great plugin. ??

    In the CSS that is minified and compiled into the page ( e.g. wp-content/cache/autoptimize/_619…..css), it seems to gather any fonts declared in the page and embed them.

    However, the src attribute in @font-face is NOT using the CDN path set in the plugin and instead uses the site’s url.

    I am on WPEngine hosting and any references to the url are transformed into the CDN path, except within the CSS file generated by Autoptimize.

    Do you have any idea how this @font-face declaration could be removed, or updated to use the CDN?

    Many thanks,

    Ben

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

    (@optimizingmatters)

    see this topic in the AO FAQ Ben ??

    hope this clarifies,
    frank

    Thread Starter nebrekab

    (@nebrekab)

    Hi Frank,

    Thanks for the swift reply!

    I’ve added the following code to our functions.php:
    add_filter( 'autoptimize_filter_css_fonts_cdn', '__return_true' );

    And also cleared the Server Cache and the AO cache, but the AO generated CSS @font-face src is still using the site’s path, rather than the CDN.

    Any ideas?

    Thanks again,

    Ben

    • This reply was modified 3 years, 10 months ago by nebrekab.
    Thread Starter nebrekab

    (@nebrekab)

    To be clear, I am seeing this in the CSS created by AO, right at the start:

    @font-face{font-family:'Matter';src:url('https://mydomain.com/wp-content/themes/hellojuno/fonts/matter/Matter-Regular.woff2') format('woff2'),...

    Where we see mydomain.com, we need to use our CDN – which is set within the AO settings under CDN Base URL.

    Is this achievable?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Is this achievable

    yes, that _should_ work with that filter actually. maybe give it a shot with the code snippets plugin instead of adding it to functions.php?

    Thread Starter nebrekab

    (@nebrekab)

    Must have been a glitch in The Matrix… ??

    That’s working now. I think the AO CSS needed a bit of time to make its way to the CDN.

    Thanks so much Frank. You rock.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, feel free to leave a review of the plugin and support here! ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘@font-face src is not using CDN’ is closed to new replies.