Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-dean committed Jan 31, 2021
2 parents 9d9e650 + f727b26 commit 4cc9b83
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/less/src/less-node/url-file-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ UrlFileManager.prototype = Object.assign(new AbstractFileManager(), {
const hackUrlStr = urlStr.indexOf('?') === -1 ? urlStr + '?' : urlStr

request.get(hackUrlStr, { follow_max: 5 }, (err, resp, body) => {
if (err || resp.statusCode >= 400) {
const message = resp.statusCode === 404
if (err || resp && resp.statusCode >= 400) {
const message = resp && resp.statusCode === 404
? `resource '${urlStr}' was not found\n`
: `resource '${urlStr}' gave this Error:\n ${err || resp.statusMessage || resp.statusCode}\n`;
reject({ type: 'File', message });
Expand Down
3 changes: 2 additions & 1 deletion packages/less/src/less/tree/dimension.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@var: 16;
@var: 10 + 6;

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

0 comments on commit 4cc9b83

Please sign in to comment.