Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3586 #3589

Merged
merged 1 commit into from Jan 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/less/src/less/tree/dimension.js
Expand Up @@ -66,7 +66,8 @@ Dimension.prototype = Object.assign(new Node(), {
// so `1px + 2` will yield `3px`.
operate(context, op, other) {
/* jshint noempty:false */
let value = this._operate(context, op, this.value, other.value), unit = this.unit.clone();
let value = this._operate(context, op, this.value, other.value);
let unit = this.unit.clone();

if (op === '+' || op === '-') {
if (unit.numerator.length === 0 && unit.denominator.length === 0) {
Expand Down
7 changes: 5 additions & 2 deletions packages/less/src/less/tree/operation.js
Expand Up @@ -29,8 +29,11 @@ Operation.prototype = Object.assign(new Node(), {
if (b instanceof Dimension && a instanceof Color) {
b = b.toColor();
}
if (!a.operate) {
if (a instanceof Operation && a.op === '/' && context.math === MATH.PARENS_DIVISION) {
if (!a.operate || !b.operate) {
if (
(a instanceof Operation || b instanceof Operation)
&& a.op === '/' && context.math === MATH.PARENS_DIVISION
) {
return new Operation(this.op, [a, b], this.isSpaced);
}
throw { type: 'Operation',
Expand Down
@@ -1,4 +1,4 @@
@var: 16;
@var: 10 + 6;

@media (min-width: @var + 1) {
.foo { bar: 1; }
Expand Down