/** * 模板引擎拓展包 * @author yutent * @date 2020/09/27 14:17:46 */ import Smarty from 'smartyx' export function createViewsPlugin() { return { name: 'views', install() { let eng = new Smarty() let conf = this.get('views') if (conf.dir) { eng.config('path', conf.dir) if (conf.ext) { eng.config('ext', conf.ext) } return eng } else { throw new Error('views.dir is empty') } } } }