-
Notifications
You must be signed in to change notification settings - Fork 6
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
shouldn't it be just "less-plugins"? #1
Comments
If other language versions of less move under less/ then no, these wouldn't |
got it, I can see the logic in that |
After thinking about this more, I actually think it would be a good idea to put each plugin in its own repo, so that they are more easily found on GitHub (e.g. when a user searches for "autoprefix", this repo will never show in results). and it seems more idiomatic to the concept of having plugins to make them separate. To make this easy, I could put a generator together so that new plugin repos can be created with thoughts? |
I think that would involve a lot of duplication.. think about testing and On the other hand you might want plug-ins seperately for the browser if I still haven't decided how plugins get invoked for lessc.. does less have So I think I'd rather keep the simple plugins together and more complex |
Yeah I like that thinking. based on that, here are a few thoughts:
How about:
|
Hi Jon,
Any pointers to how existing packages manage this would be great. |
I think the first challenge is the API for plugins, what is exposed on the less object, etc. I think 3rd party libs should do most of the heavy lifting when it comes to "how" plugins are registered. For example, if on node.js you might use grunt-contrib-less, which would load plugins and "register" them with Less.js. Regarding globally available plugins, that might not be something we want to do yet (or ever). The main problem we'll run into with globally installed plugins is version incompatibles with local packages. So at least for the short-term, enforcing that plugins need to be installed on a project-by-project basis would be the safest way to go. And pragmatically, by nature a plugin is covering something that probably doesn't belong in core Less.js, so from that standpoint it also doesn't make sense to install it globally. This makes me wonder, what do you think about breaking out the CLI into another repo, like less-cli or whatever. then the CLI could be installed globally, but less.js itself and/or plugins could be installed on a project-by-project basis. I think the CLI might get more love and attention from node.js devs (e.g. contributions) in this scenario too. |
I think I'd be quite keen on loading plugins specified from Less files, rather than configuring the environment they are loaded from. That way you would only load the plugins you needed (perhaps with dependency resolution done internally), and each project could specify its own plugins wthin a single global environment. Something like: require 'my.plugin.js'
color: my-plugin(); |
ha, that's very similar to what I was thinking (which is what led to my comment about import statements, less/less.js#1861 (comment)). I actually created a proof of concept of this months ago on assemble-less. I think it's still on a branch. But backing up a bit, I think that the recognition of the |
I would be somewhat against a require statement IN the Less file (seems like something that should be part of your options file, which we should probably finish work on). But depends on how it's done. |
Exactly my point. This should be a plugin, b/c I would absolutely love to have it. I have mixins I've been using that haven't changed a line in two years. IMO it's a perfect use case for these. |
we can technically already do this kind of thing now. here is an example (although this is only modifying a path, I see no reason why a similar function couldn't inject a string into the file), see:
So I think the big "payoff" with plugins will be the ease-of-registration and working with the API. this is interesting... ideas are flying now! |
been thinking alot about this and came to the conclusion that having one repo per plugin was good. less can pull in a plugin using a single option. |
I'm interpreting that to mean that it would search Github? Since you're talking about a repo per plugin? A few questions:
|
I think some of us are considering what plugins could/might do from different angles. I think anyone will be able to create plugins, but (correct me if I'm wrong with every thing I'm about to say @lukeapage) whether or not the plugins are from user-land or the less core team they would be registered/loaded the same way. e.g. I don't think there are any plans to automatically find plugins on github and load them. This next part I'm not as clear on, but I think the plan is to load plugins that are either explicitly specified/registered in the user's config (which could be in less files themselves or whatever), or - with the node at least - perhaps automatically registered when plugins are specified in package.json. My suggestion is that we don't do automatic loading of plugins. I've mentioned this before, but I think auto-loading is best left to user-land, regardless of platform. A good analogy is grunt and gulp plugins. By default, users are expected to explicitly define/require plugins in their configs, but there are a number of user-created projects with different approaches for auto-loading plugins. One last thought is that, IMHO, the focus for plugins should be on implementors, not end-users per se. If we make it easier for implementors to use plugins in, say, an express middleware, or gulp/grunt plugins, then by making this easier for a handful of implementors we will have effectively enabled thousands of end users to get the benefits of any plugins used - without having to worry about how they were used. Not to mention, it would be easy for gulp-less or grunt-contrib-less to allow users to register plugins in the config/options of either tool. just my 2c |
It won't search npm. It will require a module at the same level as less is |
Thank you for the taking the time to respond. My thinking is usually that looking at the code may indicate where a feature is at, but sometimes it doesn't communicate where a feature is going, so sometimes a first-hand account is more helpful. That said, would it be possible to start a v2 of less-docs to get feature documentation? That might communicate a bit more clearly than via code, and save you the frustration of answering as many questions. |
Assuming that for the moment only @lukeapage can document these things, starting it right now will kill both :) ( I mean both v2 code and v2 docs). No need to panic though, I guess most of these questions and problems will answer/solve themselves as soon as we start to use these things. |
Couldn't this be multiple plugins?
Love the fact that you made this happen! really exciting
The text was updated successfully, but these errors were encountered: