Gulpfile.js
installed via npm install --save-dev gulp-load-plugins
var gulp = require('gulp');
// Require all tasks in gulp/tasks, including subfolders
require('require-dir')('./gulp/tasks', {
recurse: true
});
var $ = require('gulp-load-plugins')();
console.log($);
No matter where I declare it, the output will always be {}. I even tried with longer version having the options, still no luck
Using $.gulpif()
gives
TypeError: Object #<Object> has no method 'gulpif'
I even downloaded few starter packs from github but still getting same output. I'm kicking myself for moving from Grunt.
In the package.json, the plugin is saved as "gulp-if": "^1.2.5"
so, I had to change the code $.gulpif()
to $.if()
since the plugin will strip the names by below logic
var pattern = arrayify(options.pattern || ['gulp-*', 'gulp.*']);
var replaceString = options.replaceString || /^gulp(-|\.)/;
name.replace(replaceString, '');
A silly mistake which took 4 hours of my time.
P.S: I don't think it'll load any plugins without the prefix gulp in it's name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With