From 9b00dc971fb5927ae6d2cffffe66c0786385df7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Sun, 27 Sep 2020 19:33:57 +0800 Subject: [PATCH] 1.0.0 --- index.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index d030be8..35896d2 100644 --- a/index.js +++ b/index.js @@ -9,6 +9,21 @@ import Smarty from 'smartyx' export default { name: 'views', install() { - // + 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) } }