If Additional CSS I use is smaller than n length (the exact length is not sure at the moment), WordPress just outputs the CSS inline itself:
But that’s not WordPress core behavior? Or is it (I can’t seem to trigger it)?
So actually AO does not support aggregating Additional CSS?
Not if it’s located in an linked stylesheet that is dynamically generated, no.
I don’t use any plugin, I use Customize -> additional CSS as well. That’s my point: I have never seen it output CSS in an linked dynamic stylesheet.
Ok, I got the root cause of it: Jetpack Custom CSS: https://jetpack.com/support/custom-css/
After disabling Jetpack completely, Additional CSS generates “static” CSS so AO can work on it. If Jetpack is activated, Additional CSS will generate “dynamic” CSS because Jetpack adds CSS preprocessors support for it that need some dynamic processing for Sass and Less to get the plain CSS that browser can parse.
After some further investigation, you can disable the Custom CSS feature by Jetpack by using debug mode. It’s hard to find in the latest version of Jetpack.
I think you can add some notice for users willing to aggregate custom CSS like me.
And thank you so much for helping me debug this tricky problem, thanks!
-
This reply was modified 7 years, 4 months ago by
Sparanoid.
wow, that’s a great find! the jetpack page confirms:
Jetpack will include the custom CSS as an in-line stylesheet inside the document by default. However, if the custom CSS exceeds 2000 characters in length, Jetpack will generate an external stylesheet and link to it.
Now looking at JetPack’s source-code you might be able to enforce the CSS being inlined with a filter;
add_filter( 'safecss_embed_style', '__return_true', 11 );
thanks for having persevered @sparanoid !
frank