Skip to content

stringparser/gulp-runtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,017 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-runtime NPM version downloads

build

image

documentation - install - setup - why

features

samples

CLI as tasks

var gulp = require('gulp-runtime').create();

gulp.task('default', ['--tasks', '--version']);

task :parameters

var gulp = require('gulp-runtime').create();

gulp.task('build :src :dest', function () {
  return gulp.src(this.params.src)
    // transform, compress, etc.
    .pipe(gulp.dest(this.params.dest));
});

gulp.task('build:dev', function (done){
  gulp.parallel("build src/**/*.js public")(done);
});

pass arguments from the task runner

var gulp = require('gulp-runtime').create();

gulp.task('build', function (done, sources, dest) {
  var stream = gulp.src(sources)
    // some build steps here

  stream.on('end', function () {
    done(stream);
  });
});

gulp.task('minify', function (done, stream) {
  return stream
    // minify
    .pipe(gulp.dest(dest));
});

// pass arguments
gulp.task('build and min', function (done) {
  gulp.series('build', 'minify')('src/**/*.js', 'dest/source.min.js', done);
});

functions as tasks

Just as gulp#4.0

var gulp = require('gulp-runtime').create();

function build (done, sources, dest) {
  return gulp.src(sources)
    // some build step
    .pipe(gulp.dest(dest));
}

function minify (done, sources, dest) {
  return gulp.src(sources)
    // minify
    .pipe(gulp.dest(dest));
}

// pass arguments
gulp.task('build min', function (done) {
  gulp.series(build, minify)('src/**/*.js', 'dest/source.min.js', done);
});

split builds in instances

var styles = require('gulp-runtime').create();

styles.task('less', function (done, sources, dest) {
  var less = require('gulp-less');
  var options = require('./build/options');

  return gulp.src(sources)
    .pipe(less(options.less))
    .pipe(gulp.dest(dest));
});

styles.task('default', ['less']);

exports = module.exports = styles;

a REPL after default has finished

var gulp = require('gulp-runtime').create({ repl: true });

gulp.task(':number', function (done) {
  setTimeout(done, 100);
});

gulp.task('default', ['one', 'two']);

go to the terminal and do

node gulpfile.js

which will run a REPL with the tasks defined.

install

With npm

npm install --save-dev gulp-runtime

why

Soon after I started to use gulp it came to mind

I want a REPL for this

Mainly because a REPL is the closest to define and use as you like. If that was possible then writing task names in this REPL will run them just as doing the same from the command line but with the benefit of not having to end and start another process.

But wait, then I realized that what I really liked from gulp is the way you can bundle and compose async functions and, to understand how one could go about this, I had to do it for myself.

The above has lead to gulp-repl, parth, runtime and finally gulp-runtime.

So yeah, it got out of hand :D.

But well oh well, here we are.

license

License

About

an alternate interface to vinyl-fs

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors