timvink / mkdocs-git-authors-plugin

MkDocs plugin to display git authors of a page.
https://timvink.github.io/mkdocs-git-authors-plugin
MIT License
68 stars 17 forks source link

Disable on Preview #46

Closed skalde closed 3 years ago

skalde commented 3 years ago

We are using your plugin in our CI system and the local preview. unfortunately it slows down the preview on saving a file.

some plugins used an enabled_if_env: entry to disable it, except on CI pipelines.

it would be nice to have this feature on your plugin too

plugins:
  - git-revision-date:
      enabled_if_env: CI
  - git-authors:
      show_contribution: true
      show_line_count: true
      enabled_if_env: CI
timvink commented 3 years ago

Good to hear you are using the plugins 😃

You suggest a solution to fix a symptom, which by itself seems like a valid approach. Another approach could be to prevent using the plugin with live-reload (mkdocs serve), only on actual builds (mkdocs build, local or on CI), adding an option like disable_on_serve: false.

I would like to understand the core issue first however, which is slow previews. The plugins use git blame to retrieve information on a file. This does indeed add some overhead to the build, but this should be milliseconds. How did you figure out that these plugins add the overhead, and do you know how much the plugins slow down the live reload? Are you using a repository with a very large amount of commits? Are you on windows?

timvink commented 3 years ago

Hi @skalde, sorry to bump this issue, I need some more input ;)

timvink commented 3 years ago

unfortunately it slows down the preview on saving a file

I haven't noticed a considerable slowdown at all using this plugin. I'm hesistant to build in extra options to shave off a couple of milliseconds. Closing for now.

If anyone can share considerable slowdowns of live-reload with the plugin, I'm willing to re-open this one :)