Aggregating is done long after assets are enqueued and only takes the exclusions (configured and some hardcoded) into account I’m afraid.
So looking at your HTML source, are your own scripts aggregated or do they remain separate?
Aggregated. This part is very well.
Before aggregate like:
<link theme.css>
<link angular.min.css> (external)
<link myscript1.css>
<link myscrip2.css>
After aggregate like:
<link autoptimize_xy.css>
<link angular.min.css>
External: add_filter(‘wp_enqueue_scripts’, [$this, ‘loadScriptsFirst’], 0);
My script: add_filter(‘wp_enqueue_scripts’, [$this, ‘loadScriptsLast’], 100);
aha, an external file, AO indeed cannot aggregate those. what you could to is change the “injection point” for CSS with below code snippet;
add_filter( 'autoptimize_filter_css_replacetag', 'blackfire_override_css_replacetag', 10, 1 );
function blackfire_override_css_replacetag($replacetag) {
return array( '</head>', 'before' );
}hope this helps,
frank
