From 9f7b903901acb0cd6ec9cb2146406a92ebf79cab Mon Sep 17 00:00:00 2001 From: Vika Date: Fri, 7 Oct 2022 19:53:04 +0300 Subject: templates: move static assets to the templates crate It makes more sense to keep CSS near the templates, and the client-side JavaScript code too, since it depends on the DOM structure to work. Additionally, the overhead of `include_dir!()` is almost completely mitigated by the fact that this is a separate crate that isn't recompiled often. The linking stage, however, is still expected to take a little bit long. But I doubt it'd be longer than what it was before, since it's the same exact files that get linked into the app. --- kittybox-rs/Cargo.lock | 63 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 20 deletions(-) (limited to 'kittybox-rs/Cargo.lock') diff --git a/kittybox-rs/Cargo.lock b/kittybox-rs/Cargo.lock index 8815b41..e8e0bf3 100644 --- a/kittybox-rs/Cargo.lock +++ b/kittybox-rs/Cargo.lock @@ -171,9 +171,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de18bc5f2e9df8f52da03856bf40e29b747de5a84e43aefff90e3dc4a21529b" +checksum = "c9e3356844c4d6a6d6467b8da2cffb4a2820be256f50a3a386c9d152bab31043" dependencies = [ "async-trait", "axum-core", @@ -204,9 +204,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4f44a0e6200e9d11a1cdc989e4b358f6e3d354fbf48478f345a17f4e43f8635" +checksum = "d9f0c0a60006f2a293d82d571f635042a72edf927539b7685bd62d361963839b" dependencies = [ "async-trait", "bytes", @@ -214,6 +214,8 @@ dependencies = [ "http", "http-body", "mime", + "tower-layer", + "tower-service", ] [[package]] @@ -1157,6 +1159,25 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "include_dir" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "482a2e29200b7eed25d7fdbd14423326760b7f6658d21a4cf12d55a50713c69f" +dependencies = [ + "include_dir_macros", +] + +[[package]] +name = "include_dir_macros" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e074c19deab2501407c91ba1860fa3d6820bfde307db6d8cb851b55a10be89b" +dependencies = [ + "proc-macro2 1.0.38", + "quote 1.0.18", +] + [[package]] name = "indexmap" version = "1.8.1" @@ -1229,8 +1250,8 @@ dependencies = [ "futures-util", "hex", "hyper", + "kittybox-frontend-renderer", "kittybox-indieauth", - "kittybox-templates", "kittybox-util", "lazy_static", "listenfd", @@ -1265,34 +1286,36 @@ dependencies = [ ] [[package]] -name = "kittybox-indieauth" +name = "kittybox-frontend-renderer" version = "0.1.0" dependencies = [ - "axum-core", - "data-encoding", + "axum", + "chrono", + "ellipse", + "faker_rand", "http", + "include_dir", + "kittybox-indieauth", + "kittybox-util", + "markup", + "microformats", "rand 0.8.5", - "serde", "serde_json", - "serde_urlencoded", - "sha2", - "url", ] [[package]] -name = "kittybox-templates" +name = "kittybox-indieauth" version = "0.1.0" dependencies = [ - "chrono", - "ellipse", - "faker_rand", + "axum-core", + "data-encoding", "http", - "kittybox-indieauth", - "kittybox-util", - "markup", - "microformats", "rand 0.8.5", + "serde", "serde_json", + "serde_urlencoded", + "sha2", + "url", ] [[package]] -- cgit 1.4.1