Skip to content

Commit

Permalink
feat(cli): add disableGoogleFont parameter to cli (#1045)
Browse files Browse the repository at this point in the history
  • Loading branch information
duxiaofeng authored and RomanHotsiy committed Sep 25, 2019
1 parent 350649d commit aceb343
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface Options {
cdn?: boolean;
output?: string;
title?: string;
disableGoogleFont?: boolean;
port?: number;
templateFileName?: string;
templateOptions?: any;
Expand Down Expand Up @@ -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',
Expand All @@ -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 || {},
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -261,6 +277,7 @@ async function getPageHTML(
: `<script>${redocStandaloneSrc}</script>`) + css
: '<script src="redoc.standalone.js"></script>',
title,
disableGoogleFont,
templateOptions,
});
}
Expand Down
2 changes: 1 addition & 1 deletion cli/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
</style>
{{{redocHead}}}
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">
{{#unless disableGoogleFont}}<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">{{/unless}}
</head>

<body>
Expand Down

0 comments on commit aceb343

Please sign in to comment.