diff --git a/lib/less/tree/url.js b/lib/less/tree/url.js index 706c1e4f8..df07c95d3 100644 --- a/lib/less/tree/url.js +++ b/lib/less/tree/url.js @@ -5,7 +5,7 @@ tree.URL = function (val, paths) { this.attrs = val; } else { // Add the base path if the URL is relative and we are in the browser - if (less.mode === 'browser' && !/^(?:https?:\/\/|file:\/\/|data:|\/)/.test(val.value) && paths.length > 0) { + if (typeof less !== 'undefined' && less.mode === 'browser' && !/^(?:https?:\/\/|file:\/\/|data:|\/)/.test(val.value) && paths.length > 0) { val.value = paths[0] + (val.value.charAt(0) === '/' ? val.value.slice(1) : val.value); } this.value = val;