chrisenytc / slush-generator

A slush generator for create slush generators
https://www.npmjs.org/package/slush-generator
MIT License
30 stars 11 forks source link

Update slushfile #4

Closed jonkemp closed 10 years ago

jonkemp commented 10 years ago

I was wondering if you were open to making the slushfile here:

https://github.com/chrisenytc/slush-generator/blob/master/templates/slushfile.js

work like the example below:

var gulp = require('gulp'),
    install = require('gulp-install'),
    conflict = require('gulp-conflict'),
    template = require('gulp-template'),
    inquirer = require('inquirer');

gulp.task('default', function (done) {
  inquirer.prompt([
    {type: 'input', name: 'name', message: 'Give your app a name', default: gulp.args.join(' ')}, // Get app name from arguments by default
    {type: 'confirm', name: 'moveon', message: 'Continue?'}
  ],
  function (answers) {
    if (!answers.moveon) {
      return done();
    }
    gulp.src(__dirname + '/templates/app/**')  // Note use of __dirname to be relative to generator
      .pipe(template(answers))                 // Lodash template support
      .pipe(conflict('./'))                    // Confirms overwrites on file conflicts
      .pipe(gulp.dest('./'))                   // Without __dirname here = relative to cwd
      .pipe(install())                         // Run `bower install` and/or `npm install` if necessary
      .on('end', function () {
        done();                                // Finished!
      });
  });
});

which is found in the slush README.

https://github.com/klei/slush/blob/master/README.md

I would prefer that as I think it's cleaner, easier to understand, etc. What do you think? I would be willing to submit a pull request.

chrisenytc commented 10 years ago

Seems like a good idea, I walk a little out of time lately and a good contribution never hurts. :+1:

chrisenytc commented 10 years ago

Or maybe we could create another cleaner generator. As an alternative to this.