Skip to content

Commit f351a29

Browse files
authored
[ui5-cli][FEATURE] Add build flag "--experimental-css-variables" (#501)
Enables UI5 builds with CSS Variables. BLI: CPOUI5FOUNDATION-346
1 parent 3c77780 commit f351a29

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

packages/cli/lib/cli/commands/build.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ build.builder = function(cli) {
100100
describe: "Overrides the framework version defined by the project",
101101
type: "string"
102102
})
103+
.option("experimental-css-variables", {
104+
describe:
105+
"If present, the CSS variables (css-variables.css, css-variables.source.less) " +
106+
"and the skeleton for a theme (library-skeleton.css, [library-skeleton-RTL.css]) are generated",
107+
default: false,
108+
type: "boolean"
109+
})
103110
.example("ui5 build", "Preload build for project without dependencies")
104111
.example("ui5 build self-contained --all", "Self-contained build for project including dependencies")
105112
.example("ui5 build --all --exclude-task=* --include-task=createDebugFiles generateAppPreload",
@@ -111,7 +118,9 @@ build.builder = function(cli) {
111118
"Build project and dependencies in dev mode, except \"sap.ui.core\" and \"sap.m\" " +
112119
"(useful in combination with --include-task)")
113120
.example("ui5 build dev",
114-
"Build project and dependencies in dev mode. Only a set of essential tasks is executed.");
121+
"Build project and dependencies in dev mode. Only a set of essential tasks is executed.")
122+
.example("ui5 build --experimental-css-variables",
123+
"Preload build for project without dependencies but with CSS variable artefacts");
115124
};
116125

117126
async function handleBuild(argv) {
@@ -162,7 +171,8 @@ async function handleBuild(argv) {
162171
jsdoc: command === "jsdoc",
163172
devExcludeProject: argv["dev-exclude-project"],
164173
includedTasks: argv["include-task"],
165-
excludedTasks: argv["exclude-task"]
174+
excludedTasks: argv["exclude-task"],
175+
cssVariables: argv["experimental-css-variables"]
166176
});
167177
}
168178

packages/cli/test/lib/cli/commands/build.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ const defaultBuilderArgs = {
3131
jsdoc: false,
3232
devExcludeProject: undefined,
3333
includedTasks: undefined,
34-
excludedTasks: undefined
34+
excludedTasks: undefined,
35+
cssVariables: undefined
3536
};
3637

3738
test.beforeEach((t) => {
@@ -487,3 +488,21 @@ test.serial("ui5 build --include-dependency (dependency not found)", async (t) =
487488
["Could not find dependency \"sap.ui.core\" for project Sample. Dependency filter is ignored"],
488489
"logger.warn should be called with expected string");
489490
});
491+
492+
493+
test.serial("ui5 build --experimental-css-variables", async (t) => {
494+
normalizerStub.resolves({
495+
metadata: {
496+
name: "Sample"
497+
},
498+
dependencies: []
499+
});
500+
args._ = ["build"];
501+
args["experimental-css-variables"] = true;
502+
await t.context.build.handler(args);
503+
t.deepEqual(
504+
builderStub.getCall(0).args[0],
505+
Object.assign({}, defaultBuilderArgs, {cssVariables: true}),
506+
"Build with activated CSS Variables is called with expected arguments"
507+
);
508+
});

0 commit comments

Comments
 (0)