Skip to content

Commit 8aed44f

Browse files
committed
Revert "(Maybe) Fixes less#3187 (couldn't repo, but found bug)"
This reverts commit 6ce370d.
1 parent 6ce370d commit 8aed44f

File tree

7 files changed

+94
-456
lines changed

7 files changed

+94
-456
lines changed

Gruntfile.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,7 @@ module.exports = function (grunt) {
190190
command: [
191191
'node bin/lessc --clean-css="--s1 --advanced" test/less/lazy-eval.less tmp/lazy-eval.css',
192192
'cd lib',
193-
'node ../bin/lessc --clean-css="--s1 --advanced" ../test/less/lazy-eval.less ../tmp/lazy-eval.css',
194-
'cd ..',
195-
// Test multiple plugins
196-
'node bin/lessc --plugin=clean-css="--s1 --advanced" --plugin=autoprefix="ie 11,Edge >= 13,Chrome >= 47,Firefox >= 45,iOS >= 9.2,Safari >= 9" test/less/lazy-eval.less tmp/lazy-eval.css'
193+
'node ../bin/lessc --clean-css="--s1 --advanced" ../test/less/lazy-eval.less ../tmp/lazy-eval.css'
197194
].join(' && ')
198195
},
199196
"sourcemap-test": {

dist/less.js

Lines changed: 43 additions & 229 deletions
Large diffs are not rendered by default.

dist/less.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/less-node/plugin-loader.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ var path = require("path"),
77
*/
88
var PluginLoader = function(less) {
99
this.less = less;
10-
this.require = function(prefix) {
10+
this.require = require;
11+
this.requireRelative = function(prefix) {
1112
prefix = path.dirname(prefix);
1213
return function(id) {
1314
var str = id.substr(0, 2);
@@ -24,6 +25,7 @@ var PluginLoader = function(less) {
2425
PluginLoader.prototype = new AbstractPluginLoader();
2526

2627
PluginLoader.prototype.loadPlugin = function(filename, basePath, context, environment, fileManager) {
28+
var self = this;
2729
var prefix = filename.slice(0, 1);
2830
var explicit = prefix === "." || prefix === "/" || filename.slice(-3).toLowerCase() === ".js";
2931
if (!explicit) {
@@ -34,6 +36,7 @@ PluginLoader.prototype.loadPlugin = function(filename, basePath, context, enviro
3436
fileManager.loadFile(filename, basePath, context, environment).then(
3537
function(data) {
3638
try {
39+
self.require = self.requireRelative(data.filename);
3740
fulfill(data);
3841
}
3942
catch (e) {

lib/less/environment/abstract-plugin-loader.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ var functionRegistry = require("../functions/function-registry"),
22
LessError = require('../less-error');
33

44
var AbstractPluginLoader = function() {
5-
// Implemented by Node.js plugin loader
6-
this.require = function() {
7-
return null;
8-
}
95
};
106

117
function error(msg, type) {
@@ -67,7 +63,7 @@ AbstractPluginLoader.prototype.evalPlugin = function(contents, context, imports,
6763

6864
try {
6965
loader = new Function("module", "require", "registerPlugin", "functions", "tree", "less", "fileInfo", contents);
70-
loader(localModule, this.require(filename), registerPlugin, registry, this.less.tree, this.less, fileInfo);
66+
loader(localModule, this.require, registerPlugin, registry, this.less.tree, this.less, fileInfo);
7167
} catch (e) {
7268
return new this.less.LessError(e, imports, filename);
7369
}

0 commit comments

Comments
 (0)