Compare commits
2 Commits
eb4dbb2448
...
bobbyd-rep
| Author | SHA1 | Date | |
|---|---|---|---|
| 1353acc4d1 | |||
| 4dda9af788 |
@@ -39,7 +39,7 @@ async function serveFile(filename: string) {
|
|||||||
const newResponse = await new Response(compressed);
|
const newResponse = await new Response(compressed);
|
||||||
// const newResponse = await new Response(file);
|
// const newResponse = await new Response(file);
|
||||||
|
|
||||||
newResponse.headers.set('Cache-Control', 'no-cache, no-transform');
|
newResponse.headers.set('Cache-Control', 'no-transform');
|
||||||
newResponse.headers.set('Content-Encoding', 'br');
|
newResponse.headers.set('Content-Encoding', 'br');
|
||||||
|
|
||||||
|
|
||||||
@@ -293,15 +293,13 @@ function connectWebsocket(request: Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function devServerWatchFiles() {
|
async function devServerWatchFiles() {
|
||||||
const parentDir = Deno.cwd().replace(/\/[^/]+$/, '');
|
|
||||||
const watcher = Deno.watchFs(["../static/", "../src/"]);
|
const watcher = Deno.watchFs(["../static/", "../src/"]);
|
||||||
for await (const event of watcher) {
|
for await (const event of watcher) {
|
||||||
if (event.kind === "modify") {
|
if (event.kind === "modify") {
|
||||||
for (const path of event.paths) {
|
for (const path of event.paths) {
|
||||||
const cachedPath = path.replace(parentDir, '');
|
const cachedPath = path.replace(Deno.cwd() + '/..', '')
|
||||||
filepathResponseCache.delete(cachedPath);
|
filepathResponseCache.delete(cachedPath);
|
||||||
console.log('Purging updated file:', cachedPath)
|
console.log('Purging updated file:', cachedPath)
|
||||||
console.log(filepathResponseCache);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user