mirror of
https://github.com/mkdocs/mkdocs.git
synced 2026-03-27 18:08:31 +07:00
Enabled clean switch for json and gh-deploy commands as well
This commit is contained in:
@@ -213,6 +213,7 @@ def build(config, live_server=False, dump_json=False, clean_site_dir=False):
|
||||
Perform a full site build.
|
||||
"""
|
||||
if clean_site_dir:
|
||||
print("Cleaning site directory")
|
||||
utils.clean_directory(config['site_dir'])
|
||||
if not live_server:
|
||||
print("Building documentation to directory: %s" % config['site_dir'])
|
||||
|
||||
@@ -24,21 +24,19 @@ def main(cmd, args, options=None):
|
||||
"""
|
||||
Build the documentation, and optionally start the devserver.
|
||||
"""
|
||||
clean_site_dir = 'clean' in options
|
||||
if cmd == 'serve':
|
||||
config = load_config(options=options)
|
||||
serve(config, options=options)
|
||||
elif cmd == 'build':
|
||||
config = load_config(options=options)
|
||||
if 'clean' in options:
|
||||
build(config, clean_site_dir=True)
|
||||
else:
|
||||
build(config)
|
||||
build(config, clean_site_dir=clean_site_dir)
|
||||
elif cmd == 'json':
|
||||
config = load_config(options=options)
|
||||
build(config, dump_json=True)
|
||||
build(config, dump_json=True, clean_site_dir=clean_site_dir)
|
||||
elif cmd == 'gh-deploy':
|
||||
config = load_config(options=options)
|
||||
build(config)
|
||||
build(config, clean_site_dir=clean_site_dir)
|
||||
gh_deploy(config)
|
||||
elif cmd == 'new':
|
||||
new(args, options)
|
||||
|
||||
Reference in New Issue
Block a user