elementor/elementor

[FEATURE REQUEST] WP CLI Command to regenerate the CSS

Nikschavan opened this issue · 8 comments

This command can be chained in the automatic site migration tools to clear the cache after the site is migrated to live from staging or vice-versa.

Right now this can be quickly run from WP CLI like this - wp eval "Elementor\Plugin::$instance->posts_css_manager->clear_cache();" Although it would be nice to have this as a dedicated command.

I just added a PR #2177 which adds this command. I will appreciate feedback on a few points -

  1. I have placed the new file in includes\ directory. Is this Ok or needs to be changed?
  2. Right now I am loading the file with require_once only when the constant WP_CLI is defined. should this be loaded with the autoloader?

Please consider this. I would like to have a control on flushing CSS files too.

I have made this as a WP Cli package which you can use in order to get this functionality - https://github.com/Nikschavan/elementor-commands/

Wow, appreciated! Thanks :)

Hi, @Nikschavan , I was trying to run wp eval "Elementor\Plugin::$instance->posts_css_manager->clear_cache();". but it show an error 'Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in phar:///usr/local/bin/wp/vendor/wp-cli/eval-command/src/Eval_Command.php(37) : eval()'d code on line 1'.

Any idea what is wrong? Thanks for your advice.

@Nikschavan It is possible that the Elementor license can be activated through WP-CLI ?? just as you do with ASTRA ??? .. create a request for it to add it but surely they will delay in considering it .. it would take you a long time to develop it your friend? ...

I would thank you infinitely.

Thank you!

Thank @Nikschavan !

Hi,
correct me if I'm wrong but this command delete CSS files but do not recreate them for each page. Though the ticket subject was 'WP CLI Command to regenerate the CSS'.

Is there a way via CLI to generate the CSS file of each page ?

thanks