Repository: mkdocs/mkdocs

Issue:
Can't get option --dirtyreload to work?
In reference to issue #990 I am trying to get a dirty reload to work. Since I have a site with almost 300 pages a full rebuild takes about 4 minutes.
Testscenario:
Use mkdocs 1.16
1. test with `mkdocs serve`, on change of a page the full site gets rebuilt
2. test with `mkdocs serve --dirtyreload`, on change of page nothing happens?
3. test with `mkdocs serve --dirtyreload --livereload`:
the output correctly states that mkdocs is `watching changes`. However on a change the full site is rebuilt and not only the changed file.

What I find strange is that when I only use `--dirtyreload` that I don't see a message taht mkdocs is `watching changes`

Is this an issue with how mkdocs watches for changes when doing `--dirtyreload` or am I doing something wrong. I have to add that I'm running using my own docker container, that's why I explicitly tried whether reload does indeed work without `--dirtyreload`

regards,
Rick



Discussion:
I think I am not sure that I use the right mkdocs version. When I run `mkdocs --version` it states _0.15.3_. I use

`https://github.com/mkdocs/mkdocs/archive/master.tar.gz` in my requirements.txt on building the environment?

Didn't notice this earlier because the flag `--dirtyreload` is accepted on running `mkdocs serve`

regards,
Rick

The options `--dirtyreload`, `--livereload`, and `--no-livereload` are mutually exclusive. You can only use one at a time. The fact that you are not getting an error when trying to use two of them is concerning. Perhaps we need to improve the docs for that.

Unfortunately, this project doesn't update/alter its version number to indicate a dev version. If you installed directly from the Git repo, then you should be using the latest code.

Finally, I agree, there is something weird going on with `--dirtyreload`. Haven't worked out what yet. Thanks for the report.


Resolving patch:
diff --git a/mkdocs/__main__.py b/mkdocs/__main__.py
--- a/mkdocs/__main__.py
+++ b/mkdocs/__main__.py
@@ -106,7 +106,7 @@ def cli():
 @click.option('-e', '--theme-dir', type=click.Path(), help=theme_dir_help)
 @click.option('--livereload', 'livereload', flag_value='livereload', help=reload_help, default=True)
 @click.option('--no-livereload', 'livereload', flag_value='no-livereload', help=no_reload_help)
-@click.option('-d', '--dirtyreload', 'livereload', flag_value='dirty', help=dirty_reload_help)
+@click.option('--dirtyreload', 'livereload', flag_value='dirty', help=dirty_reload_help)
 @common_options
 def serve_command(dev_addr, config_file, strict, theme, theme_dir, livereload):
     """Run the builtin development server"""
diff --git a/mkdocs/commands/serve.py b/mkdocs/commands/serve.py
--- a/mkdocs/commands/serve.py
+++ b/mkdocs/commands/serve.py
@@ -74,7 +74,7 @@ def builder():
         )
         config['site_dir'] = tempdir
         live_server = livereload in ['dirty', 'livereload']
-        dirty = livereload == 'dirtyreload'
+        dirty = livereload == 'dirty'
         build(config, live_server=live_server, dirty=dirty)
         return config
 
@@ -84,7 +84,7 @@ def builder():
     host, port = config['dev_addr'].split(':', 1)
 
     try:
-        if livereload in ['livereload', 'dirtyreload']:
+        if livereload in ['livereload', 'dirty']:
             _livereload(host, port, config, builder, tempdir)
         else:
             _static_server(host, port, tempdir)


Test patch: