diff --git a/makefile b/makefile index 312fbfe..f1e0024 100644 --- a/makefile +++ b/makefile @@ -11,3 +11,4 @@ build_server: make_static_files: cp -r snap-client/build snap-server/public + cp -r snap-client/node_modules/highlight.js/styles/ snap-server/public/ diff --git a/snap-client/src/app.tsx b/snap-client/src/app.tsx index ebb7e35..04d0a93 100644 --- a/snap-client/src/app.tsx +++ b/snap-client/src/app.tsx @@ -74,7 +74,9 @@ function App() { const theme = config?.highlight_theme ?? DEFAULT_THEME; const cssLink = document.createElement("link"); cssLink.rel = "stylesheet"; - cssLink.href = "https://cdn.jsdelivr.net/npm/highlight.js/styles/" + theme + ".css"; + + // add a ref to node_modules/highlight.js/styles/{theme}.css so you dont have to get it from the internet + cssLink.href = `./styles/${theme}.css`; document.head.appendChild(cssLink); return () => { document.head.removeChild(cssLink); diff --git a/snap-server/src/main.rs b/snap-server/src/main.rs index a922cd9..5891235 100644 --- a/snap-server/src/main.rs +++ b/snap-server/src/main.rs @@ -50,6 +50,7 @@ async fn main() -> std::io::Result<()> { .service(web::resource("/").to(root)) .service(Files::new("/public", "./public")) .service(Files::new("/static", "./public/static")) + .service(Files::new("/styles", "./public/styles")) }) .bind(("127.0.0.1", available_port))? .run()