Compare commits
2 Commits
b09560a4e5
...
385bcb16d8
| Author | SHA1 | Date |
|---|---|---|
|
|
385bcb16d8 | |
|
|
afe2eb4af8 |
|
|
@ -40,5 +40,8 @@ export default defineConfig({
|
||||||
distPath: {
|
distPath: {
|
||||||
root: 'dist/web',
|
root: 'dist/web',
|
||||||
},
|
},
|
||||||
|
copy: process.env.NODE_ENV === 'development' ? [
|
||||||
|
{ from: './content', to: 'content' }
|
||||||
|
] : [],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ export function createContentServer(
|
||||||
|
|
||||||
watcher
|
watcher
|
||||||
.on("add", (path) => {
|
.on("add", (path) => {
|
||||||
if (path.endsWith(".md")) {
|
if (path.endsWith(".md") || path.endsWith(".csv") || path.endsWith(".yarn")) {
|
||||||
try {
|
try {
|
||||||
const content = readFileSync(path, "utf-8");
|
const content = readFileSync(path, "utf-8");
|
||||||
const relPath = "/" + relative(contentDir, path).split(sep).join("/");
|
const relPath = "/" + relative(contentDir, path).split(sep).join("/");
|
||||||
|
|
@ -235,7 +235,7 @@ export function createContentServer(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on("change", (path) => {
|
.on("change", (path) => {
|
||||||
if (path.endsWith(".md")) {
|
if (path.endsWith(".md") || path.endsWith(".csv") || path.endsWith(".yarn")) {
|
||||||
try {
|
try {
|
||||||
const content = readFileSync(path, "utf-8");
|
const content = readFileSync(path, "utf-8");
|
||||||
const relPath = "/" + relative(contentDir, path).split(sep).join("/");
|
const relPath = "/" + relative(contentDir, path).split(sep).join("/");
|
||||||
|
|
@ -247,7 +247,7 @@ export function createContentServer(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on("unlink", (path) => {
|
.on("unlink", (path) => {
|
||||||
if (path.endsWith(".md")) {
|
if (path.endsWith(".md") || path.endsWith(".csv") || path.endsWith(".yarn")) {
|
||||||
const relPath = "/" + relative(contentDir, path).split(sep).join("/");
|
const relPath = "/" + relative(contentDir, path).split(sep).join("/");
|
||||||
delete contentIndex[relPath];
|
delete contentIndex[relPath];
|
||||||
console.log(`[删除] ${relPath}`);
|
console.log(`[删除] ${relPath}`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue