template-replacement-gulpfile.js 770 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. var gulp = require( 'gulp' );
  3. var prompt = require('../index');
  4. /**
  5. * The following is a sample gulp file for using replacement from the command prompt
  6. * Note: This replacement function is only available on the confirm operation.
  7. * This is uses lodash template module and does a basic replacement of one or more
  8. * variables
  9. *
  10. * https://www.npmjs.com/package/lodash.template
  11. */
  12. gulp.task( 'getConfirmWithReplacement', () => {
  13. return gulp.src( '../package.json' )
  14. .pipe( prompt.confirm({
  15. type:'input',
  16. name:'env',
  17. message:'Hello <%= user %>, please enter selection?',
  18. templateOptions:{ 'user': 'fred' }
  19. }, (res) => {
  20. console.log('Result', res);
  21. }) );
  22. });