Skip to content

ybybzj/gulp-load-dir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-load-dir

Loads in gulp task scripts in a designated directory.

Install

$ npm install --save-dev gulp-load-dir

Usage

When writing a gulpfile, instead of putting all gulp task logic in one file, you can just write a single line like this:

var gulp = require('gulp');
require('gulp-load-dir')(gulp);

Then you can seperate your tasks into files and put them in 'gulp/tasks' directory(default path for task scripts);

You can also pass in options, and designate the tasks directory if you will

var gulp = require('gulp');
require('gulp-load-dir')(gulp, {
  taskDir: require('path').join(__dirname, 'gulp-tasks'),
  pkg: require('./package.json'),
  cfg: require('./config.json')
});

And in your task script file,

module.exports = function task(gulp, $, opts){
  gulp.task('jshint', function(){
    return gulp.src(opts.cfg.src).pipe($.jshint({defaultFile:'jshint.rc'}))
      .pipe($.jshint.reporter('jshint-stylish'));
  });
}

This module uses 'gulp-load-plugins' to load gulp plugins, and attaches them to the '$' argument;

About

module for load gulp tasks in a designated dir

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published