Hey @wintear,
you shouldn’t need to include any files to run this.
As long as Simply Static is activated, you can use the code as is to start a static export.
Just make sure you use it within some WP hook that isn’t loaded before plugins are ready (not “init” for example).
Here is an example that works fine within the functions.php of your theme:
add_action( 'after_setup_theme', function () {
// You want to set an option/transient after a publish action was fired and do the check within this function.
$was_published = false;
if ( $was_published ) {
$simply_static = Simply_Static\Plugin::instance();
$simply_static->run_static_export();
}
} );
So instead of firing the export immediately after a publish action, you use an option to toggle the process. The action here is listening, and once the option is set, the static export is scheduled.