diff --git a/config/config.example.yml b/config/config.example.yml index 36d6a009d35..407b5b958ed 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -17,6 +17,13 @@ ui: # Trust X-FORWARDED-* headers from proxies (default = true) useProxies: true +universal: + # Whether to inline "critical" styles into the server-side rendered HTML. + # Determining which styles are critical is a relatively expensive operation; + # this option can be disabled to boost server performance at the expense of + # loading smoothness. + inlineCriticalCss: true + # The REST API server settings # NOTE: these settings define which (publicly available) REST API to use. They are usually # 'synced' with the 'dspace.server.url' setting in your backend's local.cfg. diff --git a/server.ts b/server.ts index 1731f9d10ec..d00529687de 100644 --- a/server.ts +++ b/server.ts @@ -131,6 +131,7 @@ export function app() { server.engine('html', (_, options, callback) => ngExpressEngine({ bootstrap, + inlineCriticalCss: environment.universal.inlineCriticalCss, providers: [ { provide: REQUEST, diff --git a/src/config/universal-config.interface.ts b/src/config/universal-config.interface.ts index c088dcd6579..eb89264e37f 100644 --- a/src/config/universal-config.interface.ts +++ b/src/config/universal-config.interface.ts @@ -4,4 +4,13 @@ export interface UniversalConfig extends Config { preboot: boolean; async: boolean; time: boolean; + + /** + * Whether to inline "critical" styles into the server-side rendered HTML. + * + * Determining which styles are critical is a relatively expensive operation; + * this option can be disabled to boost server performance at the expense of + * loading smoothness. + */ + inlineCriticalCss?: boolean; } diff --git a/src/environments/environment.production.ts b/src/environments/environment.production.ts index e9028b28285..8476da4fbe6 100644 --- a/src/environments/environment.production.ts +++ b/src/environments/environment.production.ts @@ -8,5 +8,6 @@ export const environment: Partial = { preboot: true, async: true, time: false, + inlineCriticalCss: true, }, }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 4aa175ebe6b..2e70279635d 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -13,6 +13,7 @@ export const environment: Partial = { preboot: false, async: true, time: false, + inlineCriticalCss: true, }, };