Let's think about the way LESS compiles for a second. If you want, you can try to run any of this in the https://fiddlesalad.com/less editor.
Here in this example, I've just included some arbitrary colors and a 'background' property to make it easier to understand. In your example when you import base.less, you are really just putting some LESS rules before the ones in your file. So, just to clarify, if we "expand" your import, the file might look like this before its compiled to CSS:
.some-css-class{
@color1: red;
background: @color1;
}
.some-css-class {
@color1: purple;
}
What does this output?
.some-css-class {
background: red;
}
Why? You might say "I've redeclared the color variable so shouldn't it recompile the rules?". However, this is fundamentally not how LESS is designed--its backwards compatible with CSS, so a rule must happen later to override a previous rule. Take this example instead:
.some-css-class{
@color1: red;
background: @color1;
}
.some-css-class {
@color1: purple;
background: @color1;
}
Here is the output you get now:
.some-css-class {
background: red;
}
.some-css-class {
background: purple;
}
The rules are split into two outputs, and because the second rule happens later in the cascade, it has a higher precedence--barring this class existing nowhere else, the 'purple' rule will take precedence.
In LESS, you "lazy load" variables -- it will always take the last value found, starting from the inner scope. Thus:
.some-css-class {
@color1: purple;
background: @color1;
@color1: blue;
}
Will output:
.some-css-class {
background: blue;
}
The unfortunate thing though, however, is if we try to extend your previous rule as a mixin, it resolves the values from each class before pulling them into your new class:
.some-css-class{
@color1: red;
background: @color1;
}
.some-css-class {
@color1: purple;
background: @color1;
@color1: blue;
}
.another-css-class {
.some-css-class();
@color1: orange;
}
Outputs:
.some-css-class {
background: red;
}
.some-css-class {
background: blue;
}
.another-css-class {
background: red;
background: blue;
}
The ideal way to "override" these values then, is to turn the original ruleset into a parametric mixin:
.some-css-class(@color1, @color2) {
background: @color1;
color: @color2;
}
.another-css-class {
.some-css-class(red, blue);
}
Finally, your output will look like this:
.another-css-class {
background: red;
color: blue;
}
EDIT: Ultimately I recommend, you copy the original rule out of the file (without modifying that file) and alter it to be a mixin in your version. Ultimately you'll end up with the same net amount of CSS as you would if you could extend and override the variables for your new class.
.some-css-classcode decided you don't need it). Either way it looks like an XY-problem (i.e. the solution for your actual problem may exist depending on why you need to override these variables).