Skip to content

Commit eb8aca2

Browse files
authored
fix(ui5-tooling-less): resolve globs relative to app namespace (#898)
To ensure that resources can be found with the specified globs in the lessToInclude configuration parameter, they have to be resolved relative to the app namespace. Fixes #896
1 parent 3e06e0b commit eb8aca2

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

packages/ui5-tooling-less/lib/task.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ module.exports = async function ({ log, workspace, dependencies, options, taskUt
4949
// find the less files in the workspace
5050
const lessResources = [];
5151
for (const glob of lessToCompile) {
52-
lessResources.push(...((await workspace.byGlobSource(glob)) || []));
52+
if (!path.isAbsolute(glob)) {
53+
lessResources.push(...((await workspace.byGlobSource(path.join(localPath, glob))) || []));
54+
} else {
55+
lessResources.push(...((await workspace.byGlobSource(glob)) || []));
56+
}
5357
}
5458

5559
// create a new resource collection including the workspance and the dependencies

showcases/ui5-app/ui5.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ builder:
9494
afterTask: replaceVersion
9595
configuration:
9696
debug: true
97-
# lessToCompile: (Optional by default css from manifest will be used)
98-
# - "css/style.less"
97+
lessToCompile: # (Optional by default css from manifest will be used)
98+
- "css/**/style.less"
9999
# https://sap.github.io/ui5-tooling/pages/extensibility/CustomServerMiddleware/
100100
server:
101101
customMiddleware:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@import "../base/base.less";
2+
3+
@import "/resources/ui5/ecosystem/demo/lib/css/variables.less";
4+
5+
@import "/resources/sap/ui/core/themes/sap_horizon/base.less";
6+
@backgroundColor: @sapHighlightColor;
7+
8+
.styledWithLess {
9+
color: @var1;
10+
background-color: @backgroundColor;
11+
border: 1px solid @libvar;
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@import "../base/base.less";
2+
3+
@import "/resources/ui5/ecosystem/demo/lib/css/variables.less";
4+
5+
@import "/resources/sap/ui/core/themes/sap_horizon_dark/base.less";
6+
@backgroundColor: @sapHighlightColor;
7+
8+
.styledWithLess {
9+
color: @var1;
10+
background-color: @backgroundColor;
11+
border: 1px solid @libvar;
12+
}

0 commit comments

Comments
 (0)