Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: watching updates docs #128

Open
Cthutu opened this issue Apr 10, 2023 · 1 comment
Open

Feature request: watching updates docs #128

Cthutu opened this issue Apr 10, 2023 · 1 comment

Comments

@Cthutu
Copy link

Cthutu commented Apr 10, 2023

Great tool btw.

But I was using the doc-open command (by pressing D) to build and open the documents (presumably using cargo doc --open) and noticed that when source files are changed the docs are not rebuilt.

This feature to trigger a rebuild and to refresh the browser window (if possible) would be really useful when dealing with documentation comments. For example, you can hit D on bacon, add comments throughout your source code, and refresh or view in the browser the changes immediately.

@Canop
Copy link
Owner

Canop commented Apr 19, 2023

Here's the current set of doc related jobs:

[jobs.doc]
command = ["cargo", "doc", "--color", "always", "--no-deps"]
need_stdout = false

# if the doc compiles, then it opens in your browser and bacon switches
# to the previous job
[jobs.doc-open]
command = ["cargo", "doc", "--color", "always", "--no-deps", "--open"]
need_stdout = false
on_success = "back" # so that we don't open the browser at each change

The last line prevents bacon from opening a new browser window or tab at each change.

I just had an idea, changing this last line to

on_success = "job:doc"

This way the doc is updated (you still have to refresh in the browser).

There's a problem which prevents me from making that the new standard: hitting back would go back to the doc-open job instead of the previous one. I could fix that with a new action for the doc job. I'll have to think. Opinion welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants