How to add custom tooltip inside grunt-init custom template

Potential question n00b, but google did not have a nice concise answer - let's fix this together.

I start to grunt, and I'm stuck on something fundamental. I found that grunt-init was moved to a separate process - fragmentation around the documentation does not make this obvious at first, but it is cool.

Now I decide that I need my own grunt-init template, which is located in the root directory of my site (until it is time to move it to the ~ / .grunt-init directory). I am using grunt 0.3.17

And going through grunt-init-jquery and other initialization patterns - I noticed that they all use standard init prompts.

I would like to create some custom tips with information pertaining to the client, perhaps add the name of the email client or the name of the project manager.

But I can’t understand for the rest of my life how to create / where to store the user prompt, which can be called inside grunt-init.

Any help appreciated

+4
source share
1 answer

UPDATE: February 8, 2012

The answer seems to be inside the init.process .

Run the process to start the input request. init.process (parameters, hints made)

  init.process({}, [ // Prompt for these values init.prompt('name'), init.prompt('description'), init.prompt('version') ], function(err, props) { // All finished, do something with the properties }); 

Where the prompt argument is an array of objects. You can add your own without registering new helpers or expanding the invitation.

Custom hints can be added like this:

  init.process({}, [ // Prompt for these values. { name: 'client_name', message: 'Who is the client contact?', default: 'Joe Smith', validator: /^[\w\-\.]+$/, warning: 'Must be only letters, numbers, dashes, dots or underscores. (If this is not for a client, say HOUSE)' }, { name: 'project_manager', message: 'Who is the project manager?', default: 'Me', validator: /^[\w\-\.]+$/, warning: 'Must be only letters, numbers, dashes, dots or underscores.' } ], function(err, props) { // All finished, do something with the properties }); 
+6
source

All Articles