views/index.js

30 lines
528 B
JavaScript
Raw Normal View History

2020-09-27 18:37:49 +08:00
/**
* 模板引擎拓展包
* @author yutent<yutent.io@gmail.com>
* @date 2020/09/27 14:17:46
*/
import Smarty from 'smartyx'
export default {
name: 'views',
install() {
2020-09-27 19:33:57 +08:00
var eng = new Smarty()
var conf = this.get('views')
if (conf.enabled) {
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')
}
}
return Object.create(null)
2020-09-27 18:37:49 +08:00
}
}