Skip to content

Commit 41cbbfd

Browse files
authored
fix(theme): variable inheritance without default imported twice
This PR should finally fix proper variable inheritance without scoping and without overriding/double importing the default files twice. This is solved by simply pointing the theme value to a non existing path in case it's default, because the default path is always imported anyway. Another workaround would have been to just replace 'default' for each component inside theme.config by an empty string, but as theme.config is a custom file, nobody would have updated it for the next release. I wanted this to be backward compatible, so i replaced the variable on the fly. However, by using any LESS function to declare a variable (i tried replace/if/when/e/%), the access breaks when trying to use such variable via @{theme} inside mixins (which are scoped). :( Even trying to trick it by using %('%s',@theme) instead of the string path did not work and resulted into "malformed import statement instead" That said ( and even if this could be considered a bug in LESS), to solve all those issues, i just replaced the mixin call by importing another overrides.less file instead, which now isn't scoped anymore, so the import using the theme-variable also works there as well Just in case somebody has made own custom components i left the loadUIOverrides mixin, but replaced the content by a comment warning so it's not a breaking change and people know what to do.
1 parent bda537d commit 41cbbfd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+120
-58
lines changed

src/definitions/collections/breadcrumb.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,5 @@
115115
});
116116
}
117117

118-
.loadUIOverrides();
118+
// stylelint-disable no-invalid-position-at-import-rule
119+
@import (multiple, optional) "../../overrides.less";

src/definitions/collections/form.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,4 +1160,5 @@
11601160
});
11611161
}
11621162

1163-
.loadUIOverrides();
1163+
// stylelint-disable no-invalid-position-at-import-rule
1164+
@import (multiple, optional) "../../overrides.less";

src/definitions/collections/grid.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1981,4 +1981,5 @@
19811981
}
19821982
}
19831983

1984-
.loadUIOverrides();
1984+
// stylelint-disable no-invalid-position-at-import-rule
1985+
@import (multiple, optional) "../../overrides.less";

src/definitions/collections/menu.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2011,4 +2011,5 @@ Floated Menu / Item
20112011
}
20122012
}
20132013

2014-
.loadUIOverrides();
2014+
// stylelint-disable no-invalid-position-at-import-rule
2015+
@import (multiple, optional) "../../overrides.less";

src/definitions/collections/message.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,4 +442,5 @@
442442
});
443443
}
444444

445-
.loadUIOverrides();
445+
// stylelint-disable no-invalid-position-at-import-rule
446+
@import (multiple, optional) "../../overrides.less";

src/definitions/collections/table.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1929,4 +1929,5 @@
19291929
});
19301930
}
19311931

1932-
.loadUIOverrides();
1932+
// stylelint-disable no-invalid-position-at-import-rule
1933+
@import (multiple, optional) "../../overrides.less";

src/definitions/elements/button.less

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2005,4 +2005,6 @@
20052005
}
20062006
}
20072007
}
2008-
.loadUIOverrides();
2008+
2009+
// stylelint-disable no-invalid-position-at-import-rule
2010+
@import (multiple, optional) "../../overrides.less";

src/definitions/elements/container.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,5 @@
294294
}
295295
}
296296

297-
.loadUIOverrides();
297+
// stylelint-disable no-invalid-position-at-import-rule
298+
@import (multiple, optional) "../../overrides.less";

src/definitions/elements/divider.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,4 +282,5 @@
282282
});
283283
}
284284

285-
.loadUIOverrides();
285+
// stylelint-disable no-invalid-position-at-import-rule
286+
@import (multiple, optional) "../../overrides.less";

src/definitions/elements/emoji.less

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,5 @@ each(@emoji-map, {
9191

9292
/* rtl:end:ignore */
9393

94-
.loadUIOverrides();
94+
// stylelint-disable no-invalid-position-at-import-rule
95+
@import (multiple, optional) "../../overrides.less";

0 commit comments

Comments
 (0)