-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplopfile.js
More file actions
executable file
·52 lines (48 loc) · 1.03 KB
/
plopfile.js
File metadata and controls
executable file
·52 lines (48 loc) · 1.03 KB
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
const HtmlTemplate = "plop-templates/html.hbs";
const actionsHtml = () => {
let actions = [];
actions = [
{
type: "add",
path: "{{path}}/{{kebabCase name}}.html",
templateFile: HtmlTemplate,
},
];
return actions;
};
module.exports = (plop) => {
// plop.addHelper("compare", function (a, b, options) {
// if (a == b) {
// //满足添加继续执行
// return options.fn(this); // 固定写法
// } else {
// //不满足条件执行{{else}}部分
// return options.inverse(this);
// }
// });
plop.setGenerator("c", {
description: "component",
prompts: [
{
type: "input",
name: "name",
message: "What is name?",
default: "hello",
},
{
type: "input",
name: "title",
message: "What is title?",
},
{
type: "input",
name: "path",
message: "What is path?",
default: "./",
},
],
actions: () => {
return actionsHtml();
},
});
};