forked from mirror/codesnap.nvim
[Fix] Using local styles instead of fetching them
parent
5c82d48f44
commit
2db69add1d
1
makefile
1
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/
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue