-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@plugin
directive is not documented
#416
Comments
@plugin
directive is not doucmented@plugin
directive is not documented
It's been on my todo list since then. Contributions always welcome! |
I see. IMHO this should include much more than just this. Like how to get a reference to the |
@AndyOGo That's pretty much all the work I'm doing for the 3.x branch. Basically NPM-based plugins and these small scripting plugins are unified under the same scoping system via The 3.x branch (now published in NPM under the "next" tag) allows you to return an object with certain function signatures. So, in your JS file, you might have something like: functions.add(name, function() {
/* "this" will be bound to an instance of "FunctionCaller",
with this.context set to where the function was called */
});
return { // you can also use module.exports =
install: function(less, pluginManager) {
// can get a reference to less here; this function is now optional
}
}
.scope {
@plugin "my-plugin";
my-special-func();
}
.another-scope {
my-special-func(); // throws an error (I hope... 3.0 is still a pre-release)
} |
I'm maintaining a list of 3.0 changes here: less/less-meta#20 The list itself may change a bit, but should be pretty close. It would be great if you want to try out different uses for |
I've been testing Here's a sample of the code I've used so far in my testing: https://gist.github.com/matthew-dean/708f180b9de7a79e2349b07d58dfafe5 |
Documented now. |
Less version 2.5 introduced the
@plugin
directive, but it is not documented anywhere.The text was updated successfully, but these errors were encountered: