An open API service indexing awesome lists of open source software.

https://github.com/assemble/assemble-ask

Assemble plugin for asking questions and storing answers.
https://github.com/assemble/assemble-ask

Last synced: about 1 year ago
JSON representation

Assemble plugin for asking questions and storing answers.

Awesome Lists containing this project

README

          

# assemble-ask [![NPM version](https://badge.fury.io/js/assemble-ask.svg)](http://badge.fury.io/js/assemble-ask)

> Assemble plugin for asking questions and storing answers.

## Install

Install with [npm](https://www.npmjs.com/)

```sh
$ npm i assemble-ask --save
```

## Usage

```js
var assemble = require('assemble');
var ask = require('assemble-ask');

app = assemble();
app.use(ask());

app.ask('What is your name?', function(err, answer) {
// answer => user's answer
});
```

**Ask stored questions**

```js
app.question('name', 'What is your name?');
app.ask('name', function(err, answer) {
// answer => user's answer
});
```

**Automatically return saved answer**

```js
app.store.set('name', 'Jon');
app.ask('name', function(err, answer) {
// answer => 'Jon'
});
```

**Force re-asking a question**

```js
app.store.set('name', 'Jon');
app.ask('name', {force: true}, function(err, answer) {
// answer => given answer
});
```

## Helpers

Also adds an `ask` helper that can lookup stored questions and answers.

**Example**

The following will prompt the user once:

```hbs
{{ask "What is your name"}}
```

If an answer is given by the user, it will be stored and automatically used until the user asks again on a new project or forces the question to be re-asked.

## API

## Related projects

* [assemble](https://www.npmjs.com/package/assemble): Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… [more](https://www.npmjs.com/package/assemble) | [homepage](http://assemble.io)
* [assemble-loader](https://www.npmjs.com/package/assemble-loader): Assemble plugin (0.6+) for loading globs of views onto custom view collections. Also works with… [more](https://www.npmjs.com/package/assemble-loader) | [homepage](https://github.com/jonschlinkert/assemble-loader)
* [assemble-permalinks](https://www.npmjs.com/package/assemble-permalinks): Permalinks plugin for assemble. (0.6+) | [homepage](https://github.com/jonschlinkert/assemble-permalinks)
* [assemble-streams](https://www.npmjs.com/package/assemble-streams): Assemble plugin that adds convenience methods for working with streams, like `toStream`, which pushes a… [more](https://www.npmjs.com/package/assemble-streams) | [homepage](https://github.com/jonschlinkert/assemble-streams)

## Running tests

Install dev dependencies:

```sh
$ npm i -d && npm test
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/assemble-ask/issues/new).

## Author

**Jon Schlinkert**

+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)

## License

Copyright © 2015 Jon Schlinkert
Released under the MIT license.

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 21, 2015._