-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugins: If minVersion >= 3.0.0, don't "pre-run" .setOptions() (#3247)
* dev – add .editorconfig * AbstractPluginLoader – check for minVersion < 3 before running .setOptions() twice * tests – separate unspecified minVersion test from minVersion: [2,0,0] test
- Loading branch information
1 parent
39ef69c
commit d542512
Showing
6 changed files
with
101 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# @see http://editorconfig.org/ | ||
|
||
# the buck stops here | ||
root = true | ||
|
||
# all files | ||
[*] | ||
end_of_line = LF | ||
indent_style = space | ||
indent_size = 4 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,6 @@ module.exports = { | |
|
||
manager.addVisitor(new Visitor()); | ||
// console.log(manager); | ||
} | ||
}, | ||
minVersion: [2,0,0] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var optionsStack = [ | ||
'option1', | ||
undefined, | ||
'option2', | ||
undefined, | ||
'option3' | ||
]; | ||
|
||
var options, error; | ||
|
||
registerPlugin({ | ||
install: function(less, pluginManager, functions) { | ||
if (!options) { | ||
error = 'setOptions() not called before install'; | ||
} | ||
}, | ||
use: function() { | ||
var pos = optionsStack.indexOf(options); | ||
|
||
if (pos === -1) { | ||
error = 'setOptions() not setting option "' + opt + '" correctly'; | ||
} | ||
if (error) { | ||
throw new Error(error); | ||
} | ||
}, | ||
setOptions: function(opts) { | ||
options = opts; | ||
}, | ||
minVersion: [2,0,0] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var optionsStack = [ | ||
'option1', | ||
undefined, | ||
'option2', | ||
undefined, | ||
'option3' | ||
]; | ||
|
||
var options, error; | ||
|
||
registerPlugin({ | ||
install: function(less, pluginManager, functions) { | ||
if (options) { | ||
error = 'setOptions() called before install'; | ||
} | ||
}, | ||
use: function() { | ||
var pos = optionsStack.indexOf(options); | ||
|
||
if (pos === -1) { | ||
error = 'setOptions() not setting option "' + opt + '" correctly'; | ||
} | ||
if (error) { | ||
throw new Error(error); | ||
} | ||
}, | ||
setOptions: function(opts) { | ||
options = opts; | ||
}, | ||
minVersion: [3,0,0] | ||
}); |