Skip to content

Commit e3d28d2

Browse files
author
Reagan Thomas
committed
readme
1 parent 5ddc6f5 commit e3d28d2

File tree

2 files changed

+80
-13
lines changed

2 files changed

+80
-13
lines changed

README.md

Lines changed: 79 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,37 @@ taskLoader({
4848

4949
These options would convert a filename such as `move-all.js` to a task with the name `move:all`.
5050

51+
### Plugins
52+
53+
##### Using gulp-load-plugins
54+
55+
You can use [gulp-load-plugins](https://www.npmjs.com/package/gulp-load-plugins) to easily lazy-load your gulp plugins. Use gulp-load-plugins in conjunction with gulp-simple-task-loader to minimize your gulpfile.
56+
57+
```js
58+
'use strict';
59+
60+
var taskLoader = require('gulp-simple-task-loader');
61+
var plugins = require('gulp-load-plugins')();
62+
63+
taskLoader({ plugins: plugins });
64+
```
65+
66+
##### Passing in plugins manually
67+
68+
If not using gulp-load-plugins you must specify which plugins you want made available to your tasks.
69+
70+
```js
71+
'use strict';
72+
73+
var taskLoader = require('gulp-simple-task-loader');
74+
var plugins = {
75+
bump: require('gulp-bump'),
76+
mocha: require('gulp-mocha')
77+
};
78+
79+
taskLoader({ plugins: plugins });
80+
```
81+
5182
## Structuring a task
5283

5384
All tasks should be functions that receive the parameters `gulp`, `config`, and `plugins`.
@@ -66,6 +97,10 @@ module.exports = function(gulp, config, plugins) {
6697

6798
### Tasks with dependencies
6899

100+
Both `deps` and `fn` are optional. This allows you to create a task that strictly calls other tasks, or a task that doesn't have dependencies. If there are no dependencies for the task you can use the above format for creating a basic task.
101+
102+
The values shown below are the defaults.
103+
69104
```js
70105
'use strict';
71106

@@ -77,27 +112,59 @@ module.exports = function(gulp, config, plugins) {
77112
};
78113
```
79114

80-
## Examples
115+
## Complete examples
81116

82117
### Using gulp-load-plugins
83118

84-
You can use [gulp-load-plugins](https://www.npmjs.com/package/gulp-load-plugins) to easily lazy-load your gulp plugins. Use gulp-load-plugins in conjunction with gulp-simple-task-loader to minimize your gulpfile.
85-
86119
```js
120+
(gulpfile.js)
121+
122+
'use strict';
123+
87124
var taskLoader = require('gulp-simple-task-loader');
88-
var plugins = require('gulp-load-plugins')();
125+
var plugins = require('gulp-load-plugins');
89126

90-
taskLoader({ plugins: plugins });
127+
taskLoader({
128+
filenameDelimiter: '-',
129+
tasknameDelimiter: ':',
130+
plugins: plugins
131+
});
91132
```
92133

93-
### Passing in plugins manually
134+
```js
135+
(tasks/lint-all.js)
136+
137+
'use strict';
138+
139+
module.exports = function(gulp, config, plugins) {
140+
return {
141+
deps: [ 'lint:client', 'lint:server' ]
142+
};
143+
};
144+
```
94145

95146
```js
96-
var taskLoader = require('gulp-simple-task-loader');
97-
var plugins = {
98-
bump: require('gulp-bump'),
99-
mocha: require('gulp-mocha')
147+
(tasks/lint-client.js)
148+
149+
'use strict';
150+
151+
module.exports = function(gulp, config, plugins) {
152+
return function() {
153+
return gulp.src('./client/**/*.js')
154+
.pipe(plugins.jshint);
155+
};
100156
};
157+
```
101158

102-
taskLoader({ plugins: plugins });
103-
```
159+
```js
160+
(tasks/lint-server.js)
161+
162+
'use strict';
163+
164+
module.exports = function(gulp, config, plugins) {
165+
return function() {
166+
return gulp.src('./server/**/*.js')
167+
.pipe(plugins.jshint);
168+
};
169+
};
170+
```

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-simple-task-loader",
3-
"version": "1.0.16",
3+
"version": "1.0.17",
44
"description": "A simple task loader for gulp",
55
"keywords": [
66
"gulp",

0 commit comments

Comments
 (0)