From aceb3438f2329da5493b81268535bb9dc9b54f55 Mon Sep 17 00:00:00 2001 From: duxiaofeng Date: Thu, 26 Sep 2019 00:14:21 +0800 Subject: [PATCH] feat(cli): add `disableGoogleFont` parameter to cli (#1045) --- 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 67f7faad39..62fbde5a0e 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 b055f786f2..bc5c5f30d1 100644 --- a/cli/template.hbs +++ b/cli/template.hbs @@ -13,7 +13,7 @@ } {{{redocHead}}} - + {{#unless disableGoogleFont}}{{/unless}}