gruntjs - How to add custom prompt inside custom grunt-init template -
potential n00b question, google didnt have nice succinct reply - lets prepare together.
i starting out grunt , stuck on fundamental. discovered grunt-init had been moved seperate process - fragmentation around documentation doesnt create obvious @ first, thats cool.
i deciding own grunt-init template sits in root directory of site (for now, until becomes time move ~/.grunt-init dir). using grunt 0.3.17
and going through grunt-init-jquery , other init templates - notice utilize standard init prompts.
i create custom prompts info relevant client, perhaps add together client email, or project managers name.
but can't life of me figure out how create/where store custom prompt can called within grunt-init.
any help appreciated
update: feb 8 2012
tne reply seems, lies within init.process
command.
start process begin prompting input. init.process(options, prompts, done)
init.process({}, [ // prompt these values init.prompt('name'), init.prompt('description'), init.prompt('version') ], function(err, props) { // finished, properties });
where prompts argument array of objects. can add together own without registering new helpers, or extending prompt.
custom prompts can added so:
init.process({}, [ // prompt these values. { name: 'client_name', message: 'who client contact?', default: 'joe smith', validator: /^[\w\-\.]+$/, warning: 'must letters, numbers, dashes, dots or underscores. (if not client, house)' }, { name: 'project_manager', message: 'who project manager?', default: 'me', validator: /^[\w\-\.]+$/, warning: 'must letters, numbers, dashes, dots or underscores.' } ], function(err, props) { // finished, properties });
gruntjs
No comments:
Post a Comment