UNPKG

560 BJavaScriptView Raw
1const { join } = require('path')
2const { isPageTplExists } = require('./isExists')
3/*
4如果选择的模板在本地存在那就返回本地模板的路径
5 */
6module.exports = function(pageTpl) {
7 if (isPageTplExists(pageTpl, 'local')) {
8 const cwd = process.cwd()
9 return {
10 __html: join(cwd, `template/${pageTpl}/index.html`),
11 __src: join(cwd, `template/${pageTpl}/src/`)
12 }
13 }
14 return {
15 __html: join(__dirname, `../template/page/${pageTpl}.html`),
16 __src: join(__dirname, `../template/src/${pageTpl}`)
17 }
18}