Skip to content

Commit

Permalink
compress files and serve them with middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
carlrafting committed Nov 13, 2024
1 parent ec59c9c commit 59d64d4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions _config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import codeHighlight from "lume/plugins/code_highlight.ts";
import feed from "lume/plugins/feed.ts";
import sitemap from "lume/plugins/sitemap.ts";
import checkUrls from "lume/plugins/check_urls.ts";
import brotli from "lume/plugins/brotli.ts";
import gzip from "lume/plugins/gzip.ts";

import lang_xml from "npm:highlight.js/lib/languages/xml";
import lang_css from "npm:highlight.js/lib/languages/css";
Expand All @@ -19,6 +21,8 @@ const site = lume({
src: "./src",
location: new URL('https://carlrafting.com')
});
site.use(gzip());
site.use(brotli());
site.use(checkUrls());
site.use(redirects());
site.use(date({
Expand Down
22 changes: 21 additions & 1 deletion deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions serve.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Server from "lume/core/server.ts";
import www from "lume/middlewares/www.ts";
import precompress from "lume/middlewares/precompress.ts";

const port = 8080;
const root = `${Deno.cwd()}/_site`;
const server = new Server({
port,
root,
});
server.use(precompress());
server.use(www({ add: false }));

server.start();
Expand Down

0 comments on commit 59d64d4

Please sign in to comment.