Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/okikio/native. An initiative which aims to make it easy to create complex, light-weight, and perfor okikio.github.io/native
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273const gulp = require("gulp");const mergeStream = require("merge-stream");const { src, dest, parallel, watch, task, series } = gulp;
// Streamline Gulp Tasksconst stream = (_src, _opt = {}) => { let _end = _opt.end; let host = typeof _src !== "string" && !Array.isArray(_src) ? _src : src(_src, _opt.opts), _pipes = _opt.pipes || [], _dest = _opt.dest === undefined ? "." : _opt.dest, _log = _opt.log || (() => {});
_pipes.forEach((val) => { if (val !== undefined && val !== null) { host = host.pipe(val); } });
if (_dest !== null) host = host.pipe(dest(_dest)); host = host.on("end", (...args) => { _log(...args); if (typeof _end === "function") _end(...args); }); // Output
if (Array.isArray(_end)) { _end.forEach((val) => { if (val !== undefined && val !== null) { host = host.pipe(val); } }); } return host;};
// A list of streamsconst streamList = (...args) => { return mergeStream.apply(null, (Array.isArray(args[0]) ? args[0] : args).map((_stream) => { return Array.isArray(_stream) ? stream(..._stream) : _stream; }) );};
// A list of gulp tasksconst tasks = (list) => { let entries = Object.entries(list); for (let [name, fn] of entries) { task(name, (...args) => fn(...args)); }};
module.exports = { parallelFn(...args) { return (done) => parallel(...args)(done); }, seriesFn(...args) { return (done) => series(...args)(done); }, src, dest, watch, task, parallel, series, stream, streamList, tasks, gulp,};