From 76faa4db097df75ea8aaeda178675a11bf27c448 Mon Sep 17 00:00:00 2001
From: duxiaofeng-github <297951292@qq.com>
Date: Tue, 24 Sep 2019 11:49:13 +0800
Subject: [PATCH] add `disableGoogleFont` parameter to cli
---
cli/index.ts | 19 ++++++++++++++++++-
cli/template.hbs | 2 +-
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/cli/index.ts b/cli/index.ts
index 67f7faad..62fbde5a 100644
--- a/cli/index.ts
+++ b/cli/index.ts
@@ -25,6 +25,7 @@ interface Options {
cdn?: boolean;
output?: string;
title?: string;
+ disableGoogleFont?: boolean;
port?: number;
templateFileName?: string;
templateOptions?: any;
@@ -99,6 +100,12 @@ YargsParser.command(
default: 'ReDoc documentation',
});
+ yargs.options('disableGoogleFont', {
+ describe: 'Disable Google Font',
+ type: 'boolean',
+ default: false,
+ });
+
yargs.option('cdn', {
describe: 'Do not include ReDoc source code into html page, use link to CDN instead',
type: 'boolean',
@@ -114,6 +121,7 @@ YargsParser.command(
output: argv.o as string,
cdn: argv.cdn as boolean,
title: argv.title as string,
+ disableGoogleFont: argv.disableGoogleFont as boolean,
templateFileName: argv.template as string,
templateOptions: argv.templateOptions || {},
redocOptions: argv.options || {},
@@ -218,7 +226,15 @@ async function bundle(pathToSpec, options: Options = {}) {
async function getPageHTML(
spec: any,
pathToSpec: string,
- { ssr, cdn, title, templateFileName, templateOptions, redocOptions = {} }: Options,
+ {
+ ssr,
+ cdn,
+ title,
+ disableGoogleFont,
+ templateFileName,
+ templateOptions,
+ redocOptions = {},
+ }: Options,
) {
let html;
let css;
@@ -261,6 +277,7 @@ async function getPageHTML(
: ``) + css
: '',
title,
+ disableGoogleFont,
templateOptions,
});
}
diff --git a/cli/template.hbs b/cli/template.hbs
index b055f786..bc5c5f30 100644
--- a/cli/template.hbs
+++ b/cli/template.hbs
@@ -13,7 +13,7 @@
}
{{{redocHead}}}
-
+ {{#unless disableGoogleFont}}{{/unless}}