• I have successfully installed and configured the plugin, and SOME of my JS and CSS is aggregated, but every JS or CSS script included via my functions.php file using the WP functions wp_register_style and wp_register_script are coming in raw. These included files are not getting aggregated and sent up to the CDN (Azure) and I cannot figure out why. Any ideas?

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

    (@optimizingmatters)

    can you share your sites URL @deejmer so I can have a look?

    Thread Starter deejmer

    (@deejmer)

    Sure, the staging URL is at: https://kbmaxweb4.azurewebsites.net/ Thanks!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, you seem to have something active that removes the domain from the enqueued script/ styles URL’s, e.g.;

    <script type='text/javascript' src='/wp-content/themes/kbmax/js/popper.min.js?ver=5.2.2'></script>

    Can you disable that functionality (plugin?) to see if that changes anything?

    Thread Starter deejmer

    (@deejmer)

    Interesting, I don’t have any plugin doing that. I have relative URIs set in the functions.php file to these assets. Are they supposed to be written in here differently? With absolute URLs? Thanks for your quick replies!

    View post on imgur.com

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, can you try outputting absolute URL’s (including domain) to see if that changes things indeed?

    Thread Starter deejmer

    (@deejmer)

    It seemed to just pull the file in the same way, just with an absolute URL. I circled the one that I changed.

    View post on imgur.com


    I don’t know, but this doesn’t seem to be the issue? Am I following best practices for including these scripts, and Autoptimize should just see them and aggregate them? I don’t understand what about my installation is different (if anything) than what you’d suggest.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I don’t know, but this doesn’t seem to be the issue?

    not sure; the CDN might be getting in the way here. what URL do you see when CDN is off?

    Thread Starter deejmer

    (@deejmer)

    Oops, I made a mistake. The Absolute URL I set wasn’t correct. The path wasn’t valid. When I set it to the correct path, the CDN picked it up (domain changed from kbmaxweb4.azurewebsites.net to kbmaxweb4.azureedge.net. So it seemed to help the CDN find it. I changed another value, and now I have two getting called from the CDN. Now the only issue is, it is not getting aggregated along with the other css/js that autoptimize seems to see.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    it is not getting aggregated along with the other css/js that autoptimize seems to see.

    and what happens when CDN is off or if you set the CDN in AO?

    Thread Starter deejmer

    (@deejmer)

    I disabled the WP Super Cache plugin which was integrated with the CDN. I then removed the CDN domain path from AO. I now get no aggregation at all, and no CDN urls. I do see an error deep on the page (line 551) reading: `/* <![CDATA[ */
    var autoptimize_ajax_object = {“ajaxurl”:”https:\/\/kbmaxweb4.azurewebsites.net\/wp-admin\/admin-ajax.php”,”error_msg”:”Your Autoptimize cache might not have been purged successfully, please check on the <a href=\”https:\/\/kbmaxweb4.azurewebsites.net\/wp-admin\/options-general.php?page=autoptimize style=\”white-space:nowrap;\”\”>Autoptimize settings page<\/a>.”,”dismiss_msg”:”Dismiss this notice.”,”nonce”:”39608abebf”};
    /* ]]> */`

    I have clicked Save Changes and Empty Cache but this message remains.

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

    (@optimizingmatters)

    that’s not an error, but an error-message that is shown if the cache purge (in the top menu) fails ??

    that being said; I still have no idea what is going wrong there I’m afraid. could be a plugin conflict of some kind, so maybe try disabling plugins (and/ or briefly switch themes) to see if you can identify a potential culprit that way?

    Thread Starter deejmer

    (@deejmer)

    I can try playing with plugins. Can you confirm though, that scripts and CSS files brought in via the method I’m using in functions.php SHOULD be detected and aggregated by AO? You don’t see anything obvious that I’m doing wrong in this regard? Should work?

    Thread Starter deejmer

    (@deejmer)

    I’ve turned off every plugin except Advanced Custom Fields PRO (I fear teh website will stop working if I do). I still have Autoptimize enabled. It still aggregates, but only a couple of JS files. Once again, none of my explicit includes for JS or CSS. Sadface.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    yeah, _should_ work ??

    Thread Starter deejmer

    (@deejmer)

    Last idea – Any chance that hosting WordPress on IIS/Azure would have any impact?

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Most of my CSS and JS not getting aggregated’ is closed to new replies.