Skip to content

Commit f8f26a1

Browse files
authored
fix(theme): dont conditional import variables to avoid scoping
The theme.less file imports variables from a 3 layer logic, meant to possibly override previous defined variables for custom theming. In 2.9 we implemented conditional checks if an element has got a custom theme to avoid importing the files multiple times. Unfortunately this activated scoping, which means variables from a theme did not override the default variables anymore or, even worse, a custom element cannot access the same custom site.variables. This PR now removes the conditional checks again. It does not hurt even if the same variable files are imported multiple time, as everything which is not LESS variable inside those files is removed by the gulp pipeline after building.
1 parent c9cbd9b commit f8f26a1

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/theme.less

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@
1616
@import "@{themesFolder}/default/globals/site.variables";
1717

1818
/* Packaged site.variables */
19-
& when not (@site = "default") {
20-
@import (optional) "@{themesFolder}/@{site}/globals/site.variables";
21-
}
19+
@import (optional) "@{themesFolder}/@{site}/globals/site.variables";
2220

2321
/* Component's site.variables */
24-
& when not (@theme = "default") {
25-
@import (optional) "@{themesFolder}/@{theme}/globals/site.variables";
26-
}
22+
@import (optional) "@{themesFolder}/@{theme}/globals/site.variables";
2723

2824
/* Site theme site.variables */
2925
@import (optional) "@{siteFolder}/globals/site.variables";
@@ -49,14 +45,10 @@
4945
@import "@{themesFolder}/default/globals/colors.less";
5046

5147
/* Packaged colors.less */
52-
& when not (@site = "default") {
53-
@import (optional) "@{themesFolder}/@{site}/globals/colors.less";
54-
}
48+
@import (optional) "@{themesFolder}/@{site}/globals/colors.less";
5549

5650
/* Packaged Theme */
57-
& when not (@theme = "default") {
58-
@import (optional) "@{themesFolder}/@{theme}/globals/colors.less";
59-
}
51+
@import (optional) "@{themesFolder}/@{theme}/globals/colors.less";
6052

6153
/* Site Theme */
6254
@import (optional) "@{siteFolder}/globals/colors.less";

0 commit comments

Comments
 (0)