Default gulp-load-plugins remove all plugin name gulp-
But how can make gulp-load-plugins default replace all plugin name which start with gulp-
to g
?
For example
gulp-sass
other-gulp-plugin
rename to
gSass
other-gulp-plugin
Default gulp-load-plugins remove all plugin name gulp-
But how can make gulp-load-plugins default replace all plugin name which start with gulp-
to g
?
For example
gulp-sass
other-gulp-plugin
rename to
gSass
other-gulp-plugin
From gulp-load-plugins options :
pattern: ['gulp-', 'gulp.', '@/gulp{-,.}'], // the glob(s) to search for
replaceString: /^gulp(-|.)/, // what to remove from the name of the module when adding it to the context
renameFn: function (name) { ... }, // a function to handle the renaming of plugins (the default works)
So you would need something like this (i.e., untested)
var plugins = require("gulp-load-plugins")({
renameFn: function(name) {
// if only it were as easy as the below : the simple case
// return name.replace(/^@*gulp(-|.)(.)/, 'g\U$2\E');
// but try this
return name.replace(/^@*gulp(-|.)(.)/, function (match, p1, p2) {
return "g" + p2.toUpperCase(); })
// p2 is the second capture group
}
});
The simple case:
I left the simple case in for instruction but you probably need the longer uncommented version in node/gulp.