-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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.install is not a function" when trying to add plugins to node script #2915
Comments
See the correct plugin instantiation examples in their docs. I.e.:
I.e. usually (actually for all plugins I know) you pass an instance/object of the plugin "class" (not the class itself). Selfnote: probably the example needs a correction since it could be misleading (another example of the same confusion). |
Closing as not an issue. |
@seven-phases-max I would say that based on the plugin documentation, plugins are actually not (strictly) following what Less is supporting, which is that a plugin returns an object with a certain signature, and not a function that can produce said object. So I wouldn't say the example needs to be updated so much as the plugins need to be updated, as they're not returning a properly formed object with required properties. They're returning a function. |
It might be reasonable for Less to attempt to create an instance if a function is returned, but I would still say that it's the plugin's responsibility to return a proper object signature when require'd. |
Oh that makes sense, thanks! Yeah it was that documentation that confused me. |
Trying to get less working from a node script but I get this error message when trying to add a plugin.
Tried with
less-plugin-autoprefix
and withless-plugin-clean-css
. Any idea what could be causing this? I'm not doing anything strange (that I know of), my code is pretty much just:Without the plugins option everything works fine. It also works fine when doing the same thing from the command line. Just installed all the modules so everything should be up to date.
The text was updated successfully, but these errors were encountered: