0

I am getting started with grunt-init templating and trying to write conditional prompts. I've been kicking this around for a few hours, and have had no real success. It probably doesn't help that javascript isn't my strongest language.

I found this answer, but it doesn't really handle what I am trying to do: grunt-init template conditional prompts

I am trying to do something along the lines of the following:

exports.template = function(grunt, init, done) {

    init.process({}, [
        // Prompt for these values.
        {
            name: 'css',
            message: 'Which CSS Preprocess are you using?',
            default: 'SASS/Less/Stylus/none'
        }
        if (css.value == 'SASS'){
            // prompt for Compass / Bourbon / None;
        }
    ], function(err, props) {
    ...

Obviously this doesn't work, but I have tried going through the grunt-init source and documentation, and haven't found anything helpful.

If this isn't possible, are there other grunt project generators that CAN handle this kind of conditional logic?

Community
  • 1
  • 1

1 Answers1

1

For anyone wondering, it appears that to do what I am requesting, you would have to modify the grunt-init source to handle these kind of conditionals. I ended up using the yeoman generator instead.

http://yeoman.io/generators.html