Fixes #7927 #11097 - Convert inline JavaScript to @plugin #13242
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes styles compatible with Less 3.x default settings (and also makes the code cleaner and eliminates global leaking).
You're welcome to take this and organize the plugin differently. I essentially concatted the inline JS in the other .less files.
Couple notes:
tinycolor
library is pasted in there.tinycolor
andcolorEasing
were leaked as globals, but I wasn't sure if they were actually consumed anywhere.tinycolor
is referenced incolorPalette
, so that sort of made sense. ButcolorEasing
?I didn't have time to do linting or look at code conformity. This should get you 99% to using
@plugin
how you want though. Basically, in Less, you can register any functions you want, which accept nodes (not JS values - you'll notice in the code for thecolorPalette
function that the index is a node with a value property, not a number; likewise, the color is a parsed Less Color node). Then, all you have to do is return a Less node from that function.Less tree nodes are here: https://github.com/less/less.js/tree/master/lib/less/tree