Closed fregante closed 6 years ago
+1, I actually thought this the other day when I was using postcss.
load-plugins already exists, but doesn't support everything gulp-load-plugins supports. It's looking at paths instead of a package.json which probably makes it less performant, and it doesn't support lazy loading which definitely makes it less performant.
cc @jonschlinkert because open source competition is pointless :)
:+1: a few people have asked for this now. I've been kind of hesitant but I'm being pushed in the direction of doing it. If we can collab with @jonschlinkert that'd be awesome. Be cool to update load-plugins
with some of the features this plugin has.
It would pretty much just be a case of taking the code from this module and changing the default options, right?
There's also load-modules, again by Jon(?!): https://www.npmjs.com/package/load-modules
Basically, yeah. And then making this module effectively be that new module + some predefined config.
Be cool to update load-plugins with some of the features this plugin has.
I'd be happy to collaborate on implementing whatever changes are needed. I can add anyone as a collab as well
@jackfranklin how about if I take a stab at implementing some of the features in load-plugins. if anything is missing, or if I miss a nuance somewhere, we can tweak until it get where it needs to be...
@jonschlinkert that sounds great! More than happy to collab or work on some PRs. Just let me know :)
@jackfranklin added you as a collab. PRs would be great :)
@jackfranklin just wanted to follow up on this. if we re-work some of the logic/options in load-plugins so it more closely matches the API of this lib - while also being more generic than this lib, would you be open to using load-plugins here? that way we can combine efforts and share knowledge on what's working best for users?
so basically we would just implement load-plugins with the defaults that make the most sense for gulp, and users would end up with the same experience and API they have now on gulp-load-plugins. but if someone needs to do customization or wants to load non-gulp plugins, then they could use load-plugins (while still having a similar API and experience).
thoughts?
I think the goal here should be to get gulp-load-plugins to this state:
var loadPlugins = require('load-plugins');
module.exports = function (options) {
options = Object.assign({}, options, {
pattern: ['gulp-*', 'gulp.*'],
replaceString: /^gulp(-|\.)/
});
return loadPlugins(options);
};
(ES6 for example only)
That would be neat :)
@jonschlinkert thanks for the reminder, sorry for not getting involved before as I said I would.
I completely agree with @callumacrae here, if we can make sure load-plugins provides everything we need, then gulp-load-plugins can become a simple wrapper around it, with some configuration that makes sense for Gulp specific cases. Any more complex cases can just customise the options gulp-load-plugins exposes, or just skip this plugin entirely and use load-plugins. Does that sound about right?
great! that sounds perfect, and don't sweat it, I've had a lot on my plate too!
I'll take a stab at refactoring load-plugins and report back here when it's done. then we can make any changes needed to get it to where it needs to be
Is https://github.com/jonschlinkert/load-plugins done? Seems to be working fine for my use case (postcss)!
This module is thankfully set up to be very configurable and it allows to load other prefixes as well, like
postcss-*
, but I didn't know that until after I searched all the internet for a similar but generic plugin.It turns out I can just do this:
My question is, can we get a generic
load-plugins
module and have this one rely on it to load gulp plugins? Nothing really would change, with the exception of the findability of the extracted module for generic use.