Skip to content

Commit

Permalink
fix(theme): dont conditional import variables to avoid scoping
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lubber-de authored Jan 22, 2023
1 parent c9cbd9b commit f8f26a1
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@
@import "@{themesFolder}/default/globals/site.variables";

/* Packaged site.variables */
& when not (@site = "default") {
@import (optional) "@{themesFolder}/@{site}/globals/site.variables";
}
@import (optional) "@{themesFolder}/@{site}/globals/site.variables";

/* Component's site.variables */
& when not (@theme = "default") {
@import (optional) "@{themesFolder}/@{theme}/globals/site.variables";
}
@import (optional) "@{themesFolder}/@{theme}/globals/site.variables";

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

/* Packaged colors.less */
& when not (@site = "default") {
@import (optional) "@{themesFolder}/@{site}/globals/colors.less";
}
@import (optional) "@{themesFolder}/@{site}/globals/colors.less";

/* Packaged Theme */
& when not (@theme = "default") {
@import (optional) "@{themesFolder}/@{theme}/globals/colors.less";
}
@import (optional) "@{themesFolder}/@{theme}/globals/colors.less";

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

0 comments on commit f8f26a1

Please sign in to comment.