|
| 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