only download redoc.js for html builder

This commit is contained in:
Min RK
2024-02-07 13:16:46 +01:00
parent ffa07afd80
commit c15116c76c

View File

@@ -128,11 +128,14 @@ templates_path = ["_templates"]
def stage_redoc_js(app, exception): def stage_redoc_js(app, exception):
"""Download redoc.js to our static files""" """Download redoc.js to our static files"""
if app.builder.name != "html":
logger.info(f"Skipping redoc download for builder: {app.builder.name}")
return
redoc_version = "2.1.3" redoc_version = "2.1.3"
redoc_url = ( redoc_url = (
f"https://cdn.redoc.ly/redoc/v{redoc_version}/bundles/redoc.standalone.js" f"https://cdn.redoc.ly/redoc/v{redoc_version}/bundles/redoc.standalone.js"
) )
dest = Path(app.builder.outdir) / "_static/redoc.js" dest = Path(app.builder.outdir) / "_static/redoc.js"
if not dest.exists(): if not dest.exists():
logger.info(f"Downloading {redoc_url} -> {dest}") logger.info(f"Downloading {redoc_url} -> {dest}")