Repository navigation
Clear site directory before build - #154
Conversation
|
I had been thinking about this, and I tend to manually nuke the site directory so I think it makes sense. However, I feel like this should be the default and I can't see why anyone would want to disable it and thus I don't think we need the config option. |
|
I found issue #16 which is pretty similar. Sorry for the code. It's my first stab at python. |
|
Why do we need to think about hidden files? Anything in the output directory should be deletable IMO. |
|
Agree re not wanting to add config if poss. Do we need to think about safety checks, eg what if someone's trying out 'site_dir = .' without knowing that it'll clean up? |
For me it would be enough to mention it in the documentation. In the meantime I'll be changing the code to be the default without the option. |
There was a problem hiding this comment.
I think we should clear the directory for an html build or a JSON build.
There was a problem hiding this comment.
Sorry, my mistake. I thought dump_json=True means dump the output to the console (as json).
|
I think this would be the safest/best default.
I think this covers most of the cases we need to worry about. It is safe and also warns the user they may have stale files in the output directory. |
|
The ideal for me would be as @d0ugal notes, but that (2) would only warn if there were any files that wouldn't otherwise be overwritten. That way --clean would actually only be used/warned when the user really does have stale build files. Failing that would be happy to go with the above as an incremental step toward that. |
|
I can try to accomplish the version outlined by @d0ugal but I don't think that I can come up with a clever solution for a staleness check as suggested by @tomchristie. What about the live server mode? Should the site directory be cleaned before rebuilding or should that stay the way it is now? |
|
The live server mode builds in a temp directory anyway, so you don't need to worry about it for this. |
|
Updates look good - will try to review fully tomorrow. @tomchristie do you have a preference when it comes to squashing vs keeping pull request history? |
|
@d0ugal No preference. |
There was a problem hiding this comment.
I think we want to support the clean flag for json building too.
|
One minor comment inline. If possible could you also mention this in the release notes under 0.10.X which I plan to include this change. And possibly a note in the documentation too here: https://github.com/tomchristie/mkdocs/blob/master/docs/index.md#building-the-site - it is almost selt documenting with the print output, but it wouldn't hurt. Then I'm happy to merge. |
|
This looks great - just waiting for Travis to verify and then I'll hit merge. |
|
I enabled the --clean switch for all commands that call build(). I hope my documentation attempt is sufficient. ;) Oh and if this is merged, #16 can be closed. :) |
…tion Clear site directory before build
|
Thanks @mdio! |
|
Likewise, it was a pleasure to work with you. |
Remove the content of site_dir to remove old files which dropped out of the documentation.