views/index.js

29 lines
513 B
JavaScript

/**
* 模板引擎拓展包
* @author yutent<yutent.io@gmail.com>
* @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')
}
}
}
}
@gm5框架的模板引擎拓展包
JavaScript 100%