gulp-load-params
v0.1.10
Published
Load gulp task just like grunt.loadTasks and pass parameters through an options object.
Downloads
23
Readme
gulp-load-params
Load gulp task just like grunt.loadTasks and pass parameters through an options object.
Usage
Require gulp-load-params in your gulpfile
var gulp = require('gulp');
require('gulp-load-params')(gulp);
// load tasks from tasks directory and
// dependencies of start with `gulp-` in package.json
// pass parameters using the options object
var options = { obj: 'obj1'};
gulp.loadTasks(__dirname, options);
// run tasks which you loaded
gulp.tasks('default', function() {
gulp.run('your_task');
})
API
gulp-load-params ⇒ loadTasks
Load gulp task just like grunt.loadTasks and pass parameters through an options object. Returns: loadTasks - loadTasks function
| Param | Type | Default | Description | | --- | --- | --- | --- | | gulp | Object | | The gulp module | | opts | Object | | optional options | | [opts.modulePrefix] | Object | "gulp-" | load dependencies that start with this prefix in package.json. | | [opts.taskPath] | Object | "tasks" | load tasks from this directory path. |
Example
gulp-load-params will return a function that is same as gulp.loadTasks
.
var loadTasks = require('gulp-load-params')(gulp);
loadTasks === gulp.loadTasks // return true
LoadTasks can load single file.
gulp.loadTasks('path/to/task.js');
LoadTasks can load specified module.
gulp.loadTasks('path/to/module');
LoadTasks can load by module's name. It will lookup from NODE_PATH
and node_modules of current module.
gulp.loadTasks('gulp-concat');
If loading a module, it will load task from tasks directory of current module, and if gulp plugins (start with gulp-) exists in dependencies of package.json, then it will load each plugin as a module.
documented by jsdoc-to-markdown.
Changelog
License
MIT License (MIT). All rights not explicitly granted in the license are reserved.
Copyright (c) 2015 John Barry
Dependencies
[email protected] - "MIT License (MIT)", documented by npm-licenses.