restart the build when adding a new page
This commit is contained in:
+2
-3
@@ -18,13 +18,12 @@ async function listDir(directoryPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dir = import.meta.dirname
|
const dir = import.meta.dirname
|
||||||
const pages = await listDir('./src/pages')
|
|
||||||
|
|
||||||
async function html() {
|
async function html() {
|
||||||
console.log(`resync...`)
|
const pages = await listDir('./src/pages')
|
||||||
|
|
||||||
pages.forEach(page=>{
|
pages.forEach(page=>{
|
||||||
if(existsSync(`${dir}/src/pages/${page}/${page}.html`)){
|
if(existsSync(`${dir}/src/pages/${page}/${page}.html`)){
|
||||||
console.log(`we find page ${page}!`)
|
|
||||||
return src([`./src/pages/${page}/${page}.html`])
|
return src([`./src/pages/${page}/${page}.html`])
|
||||||
.pipe(fileinclude({
|
.pipe(fileinclude({
|
||||||
prefix: '@@',
|
prefix: '@@',
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Example page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user