mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-22 00:26:34 +03:00
feat(cli): add disableGoogleFont
parameter to cli (#1045)
This commit is contained in:
parent
350649d8b3
commit
aceb3438f2
19
cli/index.ts
19
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(
|
|||
: `<script>${redocStandaloneSrc}</script>`) + css
|
||||
: '<script src="redoc.standalone.js"></script>',
|
||||
title,
|
||||
disableGoogleFont,
|
||||
templateOptions,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user