Skip to content

Commit

Permalink
Merge pull request DSpace#2067 from atmire/disable-inline-css
Browse files Browse the repository at this point in the history
Add configuration option to disable inlined CSS in SSR HTML
  • Loading branch information
tdonohue authored Apr 5, 2024
2 parents 1e33960 + 6203055 commit d0a8042
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions config/config.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export function app() {
server.engine('html', (_, options, callback) =>
ngExpressEngine({
bootstrap,
inlineCriticalCss: environment.universal.inlineCriticalCss,
providers: [
{
provide: REQUEST,
Expand Down
9 changes: 9 additions & 0 deletions src/config/universal-config.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions src/environments/environment.production.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export const environment: Partial<BuildConfig> = {
preboot: true,
async: true,
time: false,
inlineCriticalCss: true,
},
};
1 change: 1 addition & 0 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const environment: Partial<BuildConfig> = {
preboot: false,
async: true,
time: false,
inlineCriticalCss: true,
},
};

Expand Down

0 comments on commit d0a8042

Please sign in to comment.