Skip to content

Commit 5353a22

Browse files
committed
[INTERNAL] Add marker / metadata variables
1 parent 95b00c4 commit 5353a22

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lib/index.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,24 @@ Builder.prototype.build = function(options) {
356356
}
357357

358358
if (options.inlineCssVariables === true) {
359-
result.css = result.cssVariables + "\n" + result.css;
359+
let scopes;
360+
if (typeof result.variables.scopes === "object") {
361+
scopes = Object.keys(result.variables.scopes);
362+
} else {
363+
scopes = [];
364+
}
365+
366+
const metadataJson = JSON.stringify({"Scopes": scopes});
367+
const libraryNameDashed = options.library.name.replace(/\./g, "-");
368+
const additionalVariables = `
369+
:root {
370+
--sapUiTheme-${libraryNameDashed}: true;
371+
--sapThemeMetaData-UI5-${libraryNameDashed}: '${metadataJson}';
372+
}
373+
`;
374+
result.css = additionalVariables + result.cssVariables + "\n" + result.css;
360375
if (options.rtl) {
361-
result.cssRtl = result.cssVariables + "\n" + result.cssRtl;
376+
result.cssRtl = additionalVariables + result.cssVariables + "\n" + result.cssRtl;
362377
}
363378
}
364379

0 commit comments

Comments
 (0)