const config = require('./config.json') module.exports = function (plop) { plop.setGenerator('controller', { description: '生成新页面', prompts: [ { type: 'input', name: 'path', message: '请输入页面路径', }, { type: 'input', name: 'title', message: '请输入页面标题', default: config.VITE_APP_TITLE, }, ], actions: [ { type: 'add', path: 'page/{{path}}.html', templateFile: 'plop-template/index.html.hbs', }, { type: 'add', path: 'page/{{path}}.js', templateFile: 'plop-template/index.js.hbs', }, { type: 'add', path: 'src/views/{{path}}/index.vue', templateFile: 'plop-template/index.vue.hbs', }, { type: 'append', path: 'index.html', pattern: '', template: "{{path}}", }, ], }) }