From 3b5ed0975f92767101c14cbb2ae2b048c49bc0cd Mon Sep 17 00:00:00 2001 From: Andrew Coulton Date: Thu, 4 Apr 2019 11:32:06 +0100 Subject: [PATCH] Update visitor for less 3.x API * `Rule` nodes have now been renamed to `Declaration` so the visitRule was not firing * `URLNode.currentFileInfo` no longer exists and is replaced by `URLNode.fileInfo()` --- lib/inline-images.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/inline-images.js b/lib/inline-images.js index faab90c..93a3488 100644 --- a/lib/inline-images.js +++ b/lib/inline-images.js @@ -12,15 +12,15 @@ module.exports = function(less) { run: function (root) { return this._visitor.visit(root); }, - visitRule: function (ruleNode, visitArgs) { - this._inRule = true; - return ruleNode; + visitDeclaration: function (declarationNode, visitArgs) { + this._inDeclaration = true; + return declarationNode; }, - visitRuleOut: function (ruleNode, visitArgs) { - this._inRule = false; + visitDeclarationOut: function (declarationNode, visitArgs) { + this._inDeclaration = false; }, visitUrl: function (URLNode, visitArgs) { - if (!this._inRule) { + if (!this._inDeclaration) { return URLNode; } if (URLNode.value && URLNode.value.value && URLNode.value.value.indexOf('#') === 0) { @@ -28,7 +28,7 @@ module.exports = function(less) { // ``behavior:url(#default#VML);`` return URLNode; } - return new less.tree.Call("data-uri", [new ParamStringReplacementNode(URLNode.value)], URLNode.index || 0, URLNode.currentFileInfo); + return new less.tree.Call("data-uri", [new ParamStringReplacementNode(URLNode.value)], URLNode.index || 0, URLNode.fileInfo()); } }; return InlineImages;