wp-rocket-cli icon indicating copy to clipboard operation
wp-rocket-cli copied to clipboard

Add a possibility to generate CPCSS for the given post

Open hlorofos opened this issue 4 years ago • 3 comments

I've a plenty of posts on a site and want to create CPCSS for all my posts. Critical path generator created only css for the main page. Now I have to click through all my posts and generate CPCSS manually.

hlorofos avatar Jul 21 '20 09:07 hlorofos

Any update with the possibility to initiate the process without visiting the admin page?

hlorofos avatar Apr 18 '22 14:04 hlorofos

Would love to see this! Big part missing from my workflow keeping all posts from having good Pagespeed scores

codepuncher avatar Nov 10 '22 23:11 codepuncher

I had to return to this issue recently and found that switching the theme caused CPCSS to be generated. This lead me to create a simple plugin that fired off the switch_theme action, passing it the current theme as arguments to avoid actually having to switch to a different theme.

$theme = wp_get_theme();
$theme_name = $theme->get( 'Name' );
do_action('switch_theme', $theme_name, $theme, $theme);

This seems to work in my case. Obviously this could cause side effects if you have other code hooking into the switch_theme action.

alanablett avatar Jul 13 '23 09:07 alanablett