(core) Add config to include custom CSS

Summary:
Adds a new environment variable that allows for custom
CSS to be included in all core static pages.

Test Plan: Tested manually in grist-core.

Reviewers: paulfitz

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D3419
This commit is contained in:
George Gevoian
2022-05-11 23:08:06 -07:00
parent e6983e9209
commit 524dbf34e1
9 changed files with 61 additions and 2 deletions

View File

@@ -29,6 +29,9 @@ export interface ICreate {
sessionSecret(): string;
// Get configuration information to show at start-up.
configurationOptions(): {[key: string]: any};
// Return a string containing 1 or more HTML tags to insert into the head element of every
// static page.
getExtraHeadHtml?(): string;
}
export interface ICreateActiveDocOptions {
@@ -90,6 +93,13 @@ export function makeSimpleCreator(opts: {
if (config) { return config; }
}
return {};
}
},
getExtraHeadHtml() {
let customHeadHtmlSnippet = '';
if (process.env.APP_STATIC_INCLUDE_CUSTOM_CSS === 'true') {
customHeadHtmlSnippet += '<link rel="stylesheet" href="custom.css">';
}
return customHeadHtmlSnippet;
},
};
}