@@ -15,6 +15,8 @@ const ImportCollectorPlugin = require("./plugin/import-collector");
15
15
const VariableCollectorPlugin = require ( "./plugin/variable-collector" ) ;
16
16
const UrlCollector = require ( "./plugin/url-collector" ) ;
17
17
18
+ const LESS_OPENUI5_VERSION = require ( "../package.json" ) . version ;
19
+
18
20
// Workaround for a performance issue in the "css" parser module when used in combination
19
21
// with the "colors" module that enhances the String prototype.
20
22
// See: https://github.com/reworkcss/css/issues/88
@@ -363,12 +365,31 @@ Builder.prototype.build = function(options) {
363
365
scopes = [ ] ;
364
366
}
365
367
366
- const metadataJson = JSON . stringify ( { "Scopes" : scopes } ) ;
368
+ const libraryNameSlashed = options . library . name . replace ( / \. / g , "/" ) ;
367
369
const libraryNameDashed = options . library . name . replace ( / \. / g, "-" ) ;
370
+
371
+ // TODO: How to get theme name? .theming "sId"? parse from file path? new parameter?
372
+ const themeId = "<theme-name>" ;
373
+
374
+ const metadataJson = JSON . stringify ( {
375
+ "Path" : `UI5.${ libraryNameSlashed } .${ themeId } .library` ,
376
+ "PathPattern" : "/%frameworkId%/%libId%/themes/%themeId%/%fileId%.css" ,
377
+ "Extends" : [ "base" ] , // TODO: Read from .theming?
378
+ "Scopes" : scopes ,
379
+ "Engine" : {
380
+ "Version" : LESS_OPENUI5_VERSION ,
381
+ "Name" : "less-openui5"
382
+ } ,
383
+ "Version" : {
384
+ "Build" : "<TODO>" , // TOOD: add new property options.library.version
385
+ "Source" : "<TODO>" // TOOD: add new property options.library.version
386
+ }
387
+ } ) ;
388
+
368
389
const additionalVariables = `
369
390
:root {
370
391
--sapUiTheme-${ libraryNameDashed } : true;
371
- --sapThemeMetaData-UI5-${ libraryNameDashed } : ' ${ metadataJson } ' ;
392
+ --sapThemeMetaData-UI5-${ libraryNameDashed } : ${ metadataJson } ;
372
393
}
373
394
` ;
374
395
result . css = additionalVariables + result . cssVariables + "\n" + result . css ;
0 commit comments