Skip to content

Allow plugins to detect --dirtyreload #2600

@timvink

Description

@timvink

I maintain a plugin that relies heavily on the page events. A user using --dirtyreload will be presented with incomplete or emtpy results.

I'd like to be able to detect if the plugin is using used in dirty model. It might make sense to add it to the config (config['is_dirty'] = dirty) here:

if not dirty:
log.info("Cleaning site directory")
utils.clean_directory(config['site_dir'])
else: # pragma: no cover
# Warn user about problems that may occur with --dirty option
log.warning("A 'dirty' build is being performed, this will likely lead to inaccurate navigation and other"
" links within your site. This option is designed for site development purposes only.")

Or have is accessible as a kwarg in relevant global events, for example adding is_dirty to on_post_build

# Run `post_build` plugin events.
config['plugins'].run_event('post_build', config=config)

Perhaps there's another way I'm not seeing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions