Skip to content

Commit d0a8042

Browse files
authored
Merge pull request DSpace#2067 from atmire/disable-inline-css
Add configuration option to disable inlined CSS in SSR HTML
2 parents 1e33960 + 6203055 commit d0a8042

5 files changed

Lines changed: 19 additions & 0 deletions

File tree

config/config.example.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ ui:
1717
# Trust X-FORWARDED-* headers from proxies (default = true)
1818
useProxies: true
1919

20+
universal:
21+
# Whether to inline "critical" styles into the server-side rendered HTML.
22+
# Determining which styles are critical is a relatively expensive operation;
23+
# this option can be disabled to boost server performance at the expense of
24+
# loading smoothness.
25+
inlineCriticalCss: true
26+
2027
# The REST API server settings
2128
# NOTE: these settings define which (publicly available) REST API to use. They are usually
2229
# 'synced' with the 'dspace.server.url' setting in your backend's local.cfg.

server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export function app() {
131131
server.engine('html', (_, options, callback) =>
132132
ngExpressEngine({
133133
bootstrap,
134+
inlineCriticalCss: environment.universal.inlineCriticalCss,
134135
providers: [
135136
{
136137
provide: REQUEST,

src/config/universal-config.interface.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,13 @@ export interface UniversalConfig extends Config {
44
preboot: boolean;
55
async: boolean;
66
time: boolean;
7+
8+
/**
9+
* Whether to inline "critical" styles into the server-side rendered HTML.
10+
*
11+
* Determining which styles are critical is a relatively expensive operation;
12+
* this option can be disabled to boost server performance at the expense of
13+
* loading smoothness.
14+
*/
15+
inlineCriticalCss?: boolean;
716
}

src/environments/environment.production.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ export const environment: Partial<BuildConfig> = {
88
preboot: true,
99
async: true,
1010
time: false,
11+
inlineCriticalCss: true,
1112
},
1213
};

src/environments/environment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const environment: Partial<BuildConfig> = {
1313
preboot: false,
1414
async: true,
1515
time: false,
16+
inlineCriticalCss: true,
1617
},
1718
};
1819

0 commit comments

Comments
 (0)