From 9da8158ea98a67feda7dd517bd1ef83b2ddbf9ac Mon Sep 17 00:00:00 2001 From: yutent Date: Tue, 28 Mar 2023 15:41:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=AF=91=E6=97=B6=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=97=A0=E6=95=88=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/prod.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/prod.js b/lib/prod.js index 2b6bb03..0c99166 100644 --- a/lib/prod.js +++ b/lib/prod.js @@ -22,7 +22,9 @@ export default function compile(root = '', dist = '', conf = {}) { path: it, ext: parse(it).ext })) - .filter(it => fs.isfile(it.path)) + .filter(it => fs.isfile(it.path) && it.ext !== '') + + console.log(list) let compileFiles = function (currentPage, page, files) { for (let it of files) { @@ -115,12 +117,19 @@ export default function compile(root = '', dist = '', conf = {}) { return } let idx = list.findIndex(_ => _.path === it) + let name = it.slice(dir.length + 1) + let ext = parse(name).ext + + if (ext === '') { + return + } + list.splice(idx, 1) files.push({ - name: it.slice(dir.length + 1), + name, path: it, - ext: parse(it).ext + ext }) }) } @@ -137,6 +146,12 @@ export default function compile(root = '', dist = '', conf = {}) { if (fs.isdir(PUBLIC_DIR)) { console.log('\n正在处理静态资源 ...') fs.ls(PUBLIC_DIR, true).forEach(it => { + let ext = parse(it).ext + + if (ext === '') { + return + } + if (fs.isfile(it)) { let name = it.slice(PUBLIC_DIR.length + 1) console.log(' 复制 %s ...', name)