Skip to content

chajs/cha-load

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cha-load

Automatically load cha and register tasks.

Install

$ npm install cha-load --save-dev

Before

// Manually require cha library.
var cha = require('cha');
// Manually require all tasks.
cha.in('glob',     require('task-glob'))
    .in('combine', require('task-combine'))
    .in('replace', require('task-replace'))
    .in('writer',  require('task-writer'))
    .in('uglifyjs',require('task-uglifyjs'))
    .in('copy',    require('task-copy'))
    .in('request', require('task-request'))

After

// Now only needs require cha-load
var cha = require('cha-load')();

Usage

Load all installed tasks

require('cha-load')();

Equivalent to:

require('cha-load')({pattern: 'task-*'});

Load all tasks excluding one

You can exclude tasks using the negate ! globbing pattern:

require('cha-load')({pattern: ['task-*', '!task-coffee']});

Set custom path to package.json

require('cha-load')({config: '../package'});

Only load from devDependencies

require('cha-load')({scope: 'devDependencies'});

Only load from devDependencies and dependencies

require('cha-load')({scope: ['devDependencies', 'dependencies']});

Options

pattern

Type: String, Array Default: 'task-*' (globbing pattern)

config

Type: String, Object Default: Path to nearest package.json

scope

Type: String, Array Default: ['dependencies', 'devDependencies', 'peerDependencies']

replace

Type: String Default: 'task-'

About

Automatically load cha and register tasks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published