use build datetime as version string on static resources
This commit is contained in:
parent
150940cd8c
commit
e599007ed4
46
Cargo.lock
generated
46
Cargo.lock
generated
|
@ -133,7 +133,7 @@ checksum = "030a733c8287d6213886dd487564ff5c8f6aae10278b3588ed177f9d18f8d231"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.10",
|
||||
"quote 1.0.3",
|
||||
"syn",
|
||||
"syn 1.0.17",
|
||||
"synstructure",
|
||||
]
|
||||
|
||||
|
@ -205,7 +205,7 @@ dependencies = [
|
|||
"proc-macro-hack",
|
||||
"proc-macro2 1.0.10",
|
||||
"quote 1.0.3",
|
||||
"syn",
|
||||
"syn 1.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -317,6 +317,7 @@ dependencies = [
|
|||
"lazy_static",
|
||||
"mime_guess",
|
||||
"pulldown-cmark",
|
||||
"rbtag",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wasm-bindgen",
|
||||
|
@ -355,7 +356,7 @@ dependencies = [
|
|||
"pest_meta",
|
||||
"proc-macro2 1.0.10",
|
||||
"quote 1.0.3",
|
||||
"syn",
|
||||
"syn 1.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -428,6 +429,26 @@ dependencies = [
|
|||
"proc-macro2 1.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rbtag"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72c64936fcc0b811890a9d90020f3df5cec9c604efde88af7db6a35d365132a3"
|
||||
dependencies = [
|
||||
"rbtag_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rbtag_derive"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b75511b710ccca8adbb211e04763bd8c78fed585b0ec188a20ed9b0dd95567c4"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"syn 0.15.44",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.56"
|
||||
|
@ -469,7 +490,7 @@ checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.10",
|
||||
"quote 1.0.3",
|
||||
"syn",
|
||||
"syn 1.0.17",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -495,6 +516,17 @@ dependencies = [
|
|||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.30",
|
||||
"quote 0.6.13",
|
||||
"unicode-xid 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.17"
|
||||
|
@ -514,7 +546,7 @@ checksum = "67656ea1dc1b41b1451851562ea232ec2e5a80242139f7e679ceccfb5d61f545"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.10",
|
||||
"quote 1.0.3",
|
||||
"syn",
|
||||
"syn 1.0.17",
|
||||
"unicode-xid 0.2.0",
|
||||
]
|
||||
|
||||
|
@ -589,7 +621,7 @@ dependencies = [
|
|||
"log",
|
||||
"proc-macro2 1.0.10",
|
||||
"quote 1.0.3",
|
||||
"syn",
|
||||
"syn 1.0.17",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -636,7 +668,7 @@ checksum = "d68a5b36eef1be7868f668632863292e37739656a80fc4b9acec7b0bd35a4931"
|
|||
dependencies = [
|
||||
"proc-macro2 1.0.10",
|
||||
"quote 1.0.3",
|
||||
"syn",
|
||||
"syn 1.0.17",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
|
|
@ -20,6 +20,7 @@ include_dir = "0.5"
|
|||
js-sys = "0.3"
|
||||
mime_guess = "2.0"
|
||||
pulldown-cmark = { version = "0.7", default-features = false }
|
||||
rbtag = "0.3"
|
||||
serde = { version = "1.0", features = [ "derive" ] }
|
||||
serde_json = "1.0"
|
||||
wasm-bindgen = "0.2"
|
||||
|
|
|
@ -6,6 +6,7 @@ use chrono::NaiveDateTime;
|
|||
use handlebars::Handlebars;
|
||||
use include_dir::{include_dir, Dir};
|
||||
use js_sys::{Date, Uint8Array};
|
||||
use rbtag::BuildDateTime;
|
||||
use serde::Serialize;
|
||||
use std::vec::Vec;
|
||||
use web_sys::*;
|
||||
|
@ -71,6 +72,7 @@ lazy_static! {
|
|||
}
|
||||
|
||||
handlebars_helper!(cur_year: |dummy: u64| Date::new_0().get_full_year());
|
||||
handlebars_helper!(build_num: |dummy: u64| BuildTag{}.get_build_timestamp());
|
||||
// TODO: actually implement this helper
|
||||
handlebars_helper!(format_date: |date: u64, format: str| {
|
||||
NaiveDateTime::from_timestamp(date as i64, 0).format(format).to_string()
|
||||
|
@ -81,6 +83,7 @@ fn build_handlebars() -> Handlebars<'static> {
|
|||
|
||||
// Helpers
|
||||
hbs.register_helper("cur_year", Box::new(cur_year));
|
||||
hbs.register_helper("build_num", Box::new(build_num));
|
||||
hbs.register_helper("format_date", Box::new(format_date));
|
||||
|
||||
// Templates
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use cfg_if::cfg_if;
|
||||
use serde::Deserialize;
|
||||
use js_sys::*;
|
||||
use rbtag::BuildDateTime;
|
||||
use wasm_bindgen::prelude::*;
|
||||
use wasm_bindgen_futures::*;
|
||||
use web_sys::*;
|
||||
|
@ -153,4 +154,7 @@ pub struct Config {
|
|||
pub description: String,
|
||||
// Plugin identifier used for Standard Notes
|
||||
pub plugin_identifier: String
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(BuildDateTime)]
|
||||
pub struct BuildTag;
|
|
@ -2,7 +2,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{ blog.title }}</title>
|
||||
<link rel="stylesheet" href="/static/style.css?ver=20200410"/>
|
||||
<link rel="stylesheet" href="/static/style.css?ver={{ build_num 0 }}"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-wrapper">
|
||||
|
@ -24,6 +24,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/script.js?ver=20200410"></script>
|
||||
<script src="/static/script.js?ver={{ build_num 0 }}"></script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue