mirror of
https://github.com/less/less.js.git
synced 2026-02-13 00:15:06 -05:00
Fix lint errors and add tests for @import (plugin)
This commit is contained in:
@@ -17,7 +17,7 @@ PluginLoader.prototype.tryImportPlugin = function(resolvedFileName) {
|
||||
}
|
||||
if (plugin.minVersion) {
|
||||
if (this.compareVersion(plugin.minVersion, this.less.version) < 0) {
|
||||
console.log("plugin " + name + " requires version " + this.versionToString(plugin.minVersion));
|
||||
console.log("plugin at" + resolvedFileName + " requires version " + this.versionToString(plugin.minVersion));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,10 @@ abstractFileManager.prototype.getPath = function (filename) {
|
||||
}
|
||||
return filename.slice(0, j + 1);
|
||||
};
|
||||
|
||||
abstractFileManager.prototype.tryAppendExtension = function(path, ext) {
|
||||
return /(\.[a-z]*$)|([\?;].*)$/.test(path) ? path : path + ext;
|
||||
}
|
||||
};
|
||||
|
||||
abstractFileManager.prototype.tryAppendLessExtension = function(path) {
|
||||
return this.tryAppendExtension(path, '.less');
|
||||
|
||||
@@ -65,10 +65,10 @@ module.exports = function(environment) {
|
||||
}
|
||||
|
||||
if (importOptions.plugin) {
|
||||
path = fileManager.tryAppendExtension(path, '.js');
|
||||
var resolvedFilename = !fileManager.isPathAbsolute(path)
|
||||
? fileManager.join(currentFileInfo.currentDirectory, path)
|
||||
: path;
|
||||
var resolvedFilename = fileManager.tryAppendExtension(path, '.js');
|
||||
if (!fileManager.isPathAbsolute(path)) {
|
||||
resolvedFilename = fileManager.join(currentFileInfo.currentDirectory, resolvedFilename);
|
||||
}
|
||||
try {
|
||||
this.context.pluginManager.importPlugin(resolvedFilename);
|
||||
fileParsedFunc(null, "", resolvedFilename);
|
||||
|
||||
Reference in New Issue
Block a user