-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
68 lines (60 loc) · 1.36 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* HtmlGenerator
* @author Alexander Burtsev http://burtsev.me
* @see {@link https://github.com/albburtsev/generator-do/tree/master/html}
*/
'use strict';
var util = require('util'),
Root = require('../root');
/**
* Generator for ```yo do:html``` interface
* @name HtmlGenerator
* @since 0.0.0
* @param {Object} args
* @param {Object} options
* @param {Object} config
* @augments Root
*/
var HtmlGenerator = function(args, options, config) {
Root.apply(this, arguments);
this.log('You called the ```do:html``` sub-generator:\n');
};
util.inherits(HtmlGenerator, Root);
/**
* Prompts for HTML file creating
* @since 0.0.0
*/
HtmlGenerator.prototype.askFor = function() {
var done = this.async(),
prompts = [{
name: 'filename',
message: 'File name',
default: 'index'
}, {
name: 'title',
message: 'Page title',
default: ''
}, {
type: 'confirm',
name: 'isSEO',
message: 'Do you need SEO meta-tags?',
default: false
}, {
type: 'confirm',
name: 'withBootstrap',
message: 'Do you need Twitter Bootstrap?',
default: false
}];
this.prompt(prompts, function(props) {
this._.extend(this, props);
done();
}.bind(this));
};
/**
* Creates file from template
* @since 0.0.0
*/
HtmlGenerator.prototype.files = function() {
this.template('index.html', this.filename + '.html');
};
module.exports = HtmlGenerator;