• Hello,

    I’m using CDN for all my assets via your plugin, which works perfectly.

    However, if I select “Aggregate all linked CSS-files? If this option is off, the individual CSS-files will remain in place but will be minified.” option, font-family URL is replaced with the website domain, not with the CDN one.

    > For example:
    When set the Aggregate option is OFF, your plugin combines CSS scripts, and serves it from cdn.wojtek.ch domain.

    url(https://cdn.wojtek.ch/wp-content/themes/ecko-hydra/./assets/font/Muli-Regular.woff) format("woff")

    But when I set the Aggregate option to ON. It combines ALL assets to 1 file and serves it from CND, but (in my case) fonts URL is set for //wojtek.ch domain.
    url(//wojtek.ch/wp-content/themes/ecko-hydra/./assets/font/Muli-Regular.woff) format("woff") which is not what I want.

    In the original file:
    font is defined as:
    url(“./assets/font/Muli-Regular.woff”) format(“woff”);

    Could you take a look at this problem? Thanks!

    Wojtek.

    The page I need help with: [log in to see the link]

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

    (@optimizingmatters)

    hmmm … by default AO should not put fonts on the CDN (to avoid CORS issues), so I’ll look into why it does when files are not aggregated. thanks for pointing that out! πŸ™‚

    if you _want_ fonts CDN’ed, you can tell AO to do so with this code snippet;
    add_filter('autoptimize_filter_css_fonts_cdn',__return_true);

    hope this helps,
    frank

    Thread Starter wandrzejczak

    (@wandrzejczak)

    Hello Frank,

    I’ve added your filter, but then I get this:

    url("https://wojtek.ch/wp-content/themes/ecko-hydra/assets/font/Muli-Regular.woff") format("woff")

    What has changed is HTTPS protocol is added πŸ™‚
    But a CDN domain is not in use πŸ™

    I’ve my own Nginx server, so I’ve already added proper CORS settings πŸ™‚

    Wojtek.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    and is your CDN set in AO?

    Thread Starter wandrzejczak

    (@wandrzejczak)

    yes it is:
    CDN Base URL: https://cdn.wojtek.ch

    I’ve tired also set:
    CDN Base URL: //cdn.wojtek.ch

    but no difference.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    so where/ how did you add the code snippet?

    and did you clear AO’s and your page cache?

    Thread Starter wandrzejczak

    (@wandrzejczak)

    I’ve added add_filter('autoptimize_filter_css_fonts_cdn',__return_true); to the end of functions.php and cleared cache.

    Thread Starter wandrzejczak

    (@wandrzejczak)

    Ok I got this.
    If I select “Save aggregated script/css as static files?” then it makes this problem appear. As soon as I disable this option and reload. it is ok.

    • This reply was modified 6 years, 8 months ago by wandrzejczak.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, seems like due to “some” inline CSS things break in that case, could you try excluding each block of inline CSS from autoptimization one by one to find the offending one?

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

The topic ‘Aggregate all linked CSS-files – CDN issue’ is closed to new replies.