Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Add interactive console prompts to gulp
JavaScript
branch: master

This branch is 2 commits ahead, 13 commits behind Freyskeyd:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
README.md
index.js
package.json

README.md

Gulp prompt

Add interaction to gulp tasks.

Confirm

Default message and false value as default value:

gulp.task('default', function () {

  gulp.src('test.js')
      .pipe(prompt._confirm())
      .pipe(gulp.dest('dest'));

});

Custom message and false value as default value:

gulp.task('default', function () {

  gulp.src('test.js')
      .pipe(prompt._confirm('Are you ready for Gulp?'))
      .pipe(gulp.dest('dest'));
});

Custom message and true value as default value:

gulp.task('default', function () {

  gulp.src('test.js')
      .pipe(prompt._confirm(
        {
          message: 'Are you ready for Gulp?',
          default: true
        })
      )
      .pipe(gulp.dest('dest'));

});

Example Checkbox:

var gulp = require('gulp'),
    prompt = require('gulp-prompt'),
    _ = require('lodash');

gulp.task('testJS', function () {
    console.log('testJS');
});

gulp.task('testCss', function () {
    console.log('testCSS');
});

gulp.task('default', function () {

    var tasks = _.chain(gulp.tasks).keys().without('default').value();

    gulp.src('gulpfile.js')
        .pipe(prompt._checkbox('choice', tasks, function (val, file, async) {

            gulp.run.apply(gulp, val);

        }));
});
Something went wrong with that request. Please try again.