-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
15 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,12 +205,14 @@ pub struct BIFiles { | |
pub license: &'static str, | ||
} | ||
|
||
impl BIFiles { | ||
/// Version of the package. | ||
pub const VERSION: &'static str = "v1.11.3"; | ||
/// allows compile time concatenation with other strings to make const 'static str | ||
macro_rules! version { () => ( "v1.11.3" ) } | ||
/// provides a resuable path to the bootstrap-icons files that we can make const 'static str with | ||
macro_rules! path { () => ( concat!("../../bootstrap-icons-", version!(), "/") ) } | ||
|
||
impl BIFiles { | ||
/// Name of the package. | ||
pub const NAME: &'static str = "bootstrap-icons-v1.11.3"; | ||
pub const NAME: &'static str = concat!("bootstrap-icons-", version!()); | ||
|
||
/// All bootstrap-icons files. | ||
/// | ||
|
@@ -221,10 +223,10 @@ impl BIFiles { | |
/// ``` | ||
/// (That way it will be an error if a file is added/removed.) | ||
pub const FILES: Self = Self { | ||
css: include_str!("../../bootstrap-icons-v1.11.3/bootstrap-icons.css"), | ||
font_woff: include_bytes!("../../bootstrap-icons-v1.11.3/fonts/bootstrap-icons.woff"), | ||
font_woff2: include_bytes!("../../bootstrap-icons-v1.11.3/fonts/bootstrap-icons.woff2"), | ||
license: include_str!("../../bootstrap-icons-v1.11.3/fonts/LICENSE"), | ||
css: include_str!(concat!(path!(), "bootstrap-icons.css")), | ||
font_woff: include_bytes!(concat!(path!(), "fonts/bootstrap-icons.woff")), | ||
font_woff2: include_bytes!(concat!(path!(), "fonts/bootstrap-icons.woff2")), | ||
license: include_str!(concat!(path!(), "fonts/LICENSE")), | ||
}; | ||
|
||
/// Load the bootstrap-icons files from the official cdn. | ||
|
@@ -233,7 +235,11 @@ impl BIFiles { | |
pub const fn cdn() -> VNode { | ||
VNode::VRaw(VRaw { | ||
html: AttrValue::Static( | ||
r#"<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">"#, | ||
concat!( | ||
r#"<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@"#, | ||
version!(), | ||
r#"/font/bootstrap-icons.css">"# | ||
), | ||
), | ||
}) | ||
} | ||
|