Skip to content

Commit ddb5c9e

Browse files
committed
docs: preliminary structure for the documentation
1 parent 135bb03 commit ddb5c9e

File tree

2 files changed

+130
-18
lines changed

2 files changed

+130
-18
lines changed

README.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
1-
## gulp-runtime [![NPM version][badge-version]][x-npm] [![downloads][badge-downloads]][x-npm]
1+
## gulp-runtime [![NPM version][badge-version]][npm] [![downloads][badge-downloads]][npm]
22

3-
[![build][badge-build]][x-travis]
3+
[![build][badge-build]][travis-build]
44

5-
> an alternate interface to [vinyl-fs][x-vinylFs]
5+
> an alternate interface to [`vinyl-fs`][vinylFs]
66
77
[install](#install) -
8-
[examples](#examples) -
8+
[docs](#docs) -
99
[why](#why) -
1010
[license](#license)
1111

12+
## sample
1213

13-
## why
14-
15-
This started as repl for gulp with a simple interface (completion and cli commands). But it was somewhat limited by how functions were composed at runtime and how you could run a functions previously set. As the project grew I wanted to be able to have more control over task definition and execution. To make this happen:
14+
```js
15+
```
1616

17-
- [parth][p-parth] path-to-regex madness
18-
- [tornado][p-tornado] composing asynchronous functions
19-
- [tornado-repl][p-tornado-repl] a repl for tornado
17+
## Features
2018

21-
So now the project puts together this things learnt for [vinyl-fs][p-vinylFs] giving an alternate interface for it.
19+
- [Instances](docs/README.md#multiple-instances)
20+
- [gulp API and more](docs/README.md#gulp-api-and-more)
21+
- [REPL with autocomplete](docs/README.md#repl-with-autocomplete)
22+
- [Tasks names :can have :parameters](docs/README.md#tasks-with-parameters)
2223

2324
## install
2425

25-
With [npm](http://www.npmjs.com)
26+
With [npm][npm]
2627

2728
```sh
2829
npm install gulp-runtime
2930
```
3031

3132
## license
3233

33-
[![License][badge-license]][x-license]
34+
[![License][badge-license]][license]
3435

3536
<!-- links -->
3637

37-
[x-npm]: https://npmjs.com/gulp-runtime
38-
[x-travis]: https://travis-ci.org/stringparser/gulp-runtime/builds
39-
[x-license]: http://opensource.org/licenses/MIT
40-
[x-vinylFs]: https://www.npmjs.com/package/vinyl-fs
41-
[x-new-issue]: https://github.com/stringparser/gulp-runtime/issues/new
38+
[license]: http://opensource.org/licenses/MIT
39+
[vinylFs]: https://www.npmjs.com/package/vinyl-fs
40+
[travis-build]: https://travis-ci.org/stringparser/gulp-runtime/builds
4241

4342
[badge-build]: http://img.shields.io/travis/stringparser/gulp-runtime/master.svg?style=flat-square
4443
[badge-version]: http://img.shields.io/npm/v/gulp-runtime.svg?style=flat-square

docs/README.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# docs
2+
3+
Something missing or points to improve?
4+
5+
Feel free to open a [new issue][new-issue]
6+
7+
## API
8+
9+
The api is essentially the same as [gulp API][gulp-api]
10+
11+
- [gulp.src](#gulptask)
12+
- [gulp.dest](#gulptask)
13+
- [gulp.task](#gulptask)
14+
- [gulp.watch](#gulptask)
15+
16+
and 4 additional methods
17+
18+
- [gulp.start](#gulpstart)
19+
- [gulp.stack](#gulp.stack)
20+
- [gulp.series](#gulp.series)
21+
- [gulp.parallel](#gulp.parallel)
22+
23+
To use a `gulpfile` you would only have to change this line
24+
25+
```js
26+
var gulp = require('gulp');
27+
```
28+
29+
with this one
30+
31+
```js
32+
var gulp = require('gulp-runtime').create();
33+
```
34+
35+
### gulp.task
36+
37+
`gulp.src`, `gulp.dest`, `gulp.watch` and `gulp.task` behave the same as described in the [`gulp` documentation][gulp-docs].
38+
39+
In addition, `gulp.task` can also define task using `:parameters`. These parameters will then pop up at the tasks's function `this.params`.
40+
41+
Example:
42+
43+
```js
44+
var gulp = require('gulp-runtime').create();
45+
46+
gulp.task('build:mode', function (done) {
47+
console.log(this.params.mode);
48+
// do async things
49+
done(); // or return a stream, promise or RxJS observable
50+
});
51+
```
52+
53+
You could also use a regular expression right after `:mode` or just an regex enclosed in parens as in:
54+
55+
```js
56+
var gulp = require('gulp-runtime').create();
57+
58+
gulp.task('build:mode(-dev|-prod)', function (done){
59+
// do async things
60+
done(); // or return a stream, promise or RxJS observable
61+
});
62+
```
63+
64+
More details on what can be a parameter on the [parth][parth] module.
65+
66+
### gulp.start
67+
68+
```js
69+
function start(tasks...[, options])
70+
```
71+
72+
Run any number of `task...` given. Tasks can be either a `string` (that matches one of the tasks registered) or a `function`.
73+
74+
Example:
75+
76+
```js
77+
var gulp = require('gulp-runtime').create();
78+
79+
function build(done){
80+
// do async things
81+
done(); // or return a stream, promise or RxJS observable
82+
}
83+
84+
gulp.task('name', function (){
85+
86+
});
87+
```
88+
89+
## Multiple instances
90+
91+
## REPL with autocomplete
92+
93+
## Tasks with parameters
94+
95+
## comose series and parallel tasks
96+
97+
## why
98+
99+
I wanted to do a REPL for gulp.
100+
101+
Why? Because I really love how gulp lets you package asynchronous functions and reuse them while letting you use the tool you prefer (callbacks, promises, streams and later even RxJS observables). So the REPL was the ultimate `define and use as use as you like` paradigm.
102+
103+
Of course, then, more and more stuff had to go in and, more importantly, the REPL had to behave in such a way that it could be used mostly like the terminal does (autocompletion, etc.).
104+
105+
So it got out of hand. Very much so. But well oh well, here we are.
106+
107+
<!-- links -->
108+
109+
[npm]: https://npmjs.com/gulp-runtime
110+
[parth]: https://github.com/stringparser/parth
111+
[license]: http://opensource.org/licenses/MIT
112+
[gulp-api]: https://github.com/gulpjs/gulp/blob/master/docs/API.md
113+
[new-issue]: https://github.com/stringparser/gulp-runtime/issues/new

0 commit comments

Comments
 (0)