-
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
17 changed files
with
165 additions
and
39 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "icons" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
authors = ["ALeX Kazik <[email protected]>"] | ||
edition = "2021" | ||
license = "MIT" | ||
|
@@ -10,4 +10,4 @@ yew = { version = "0.21", features = ["csr"] } | |
yew-bootstrap = { path = "../../packages/yew-bootstrap" } | ||
|
||
[[bin]] | ||
name = "copy-bootstrap-icons" | ||
name = "include-bootstrap-icons" |
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[[hooks]] | ||
stage = "build" | ||
stage = "post_build" | ||
command = "cargo" | ||
command_arguments = ["run", "--bin", "copy-bootstrap-icons"] | ||
command_arguments = ["run", "--bin", "include-bootstrap-icons"] |
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use std::path::PathBuf; | ||
use yew_bootstrap::icons::BIFiles; | ||
|
||
fn main() -> Result<(), std::io::Error> { | ||
let staging_dir = PathBuf::from( | ||
std::env::var("TRUNK_STAGING_DIR").expect("Environment variable TRUNK_STAGING_DIR"), | ||
); | ||
|
||
let path = staging_dir.join(BIFiles::NAME); | ||
if !path.is_dir() { | ||
std::fs::create_dir(&path)?; | ||
} | ||
BIFiles::copy(&path)?; | ||
|
||
let path = staging_dir.join("index.html"); | ||
let index = std::fs::read_to_string(&path)?; | ||
let index = index.replace( | ||
"<!include-bootstrap-icons>", | ||
&format!( | ||
r#"<link rel="stylesheet" href="bootstrap-icons-{}/bootstrap-icons.css"/>"#, | ||
BIFiles::VERSION | ||
), | ||
); | ||
std::fs::write(&path, index)?; | ||
|
||
Ok(()) | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "yew-bootstrap" | ||
version = "0.10.0" | ||
version = "0.10.1" | ||
authors = ["Matthew Scheffel <[email protected]>", "Foorack <[email protected]>"] | ||
edition = "2021" | ||
license = "MIT" | ||
|
Binary file removed
BIN
-161 KB
packages/yew-bootstrap/bootstrap-icons-v1.10.5/fonts/bootstrap-icons.woff
Binary file not shown.
Binary file removed
BIN
-118 KB
packages/yew-bootstrap/bootstrap-icons-v1.10.5/fonts/bootstrap-icons.woff2
Binary file not shown.
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
2 changes: 1 addition & 1 deletion
2
...rap/bootstrap-icons-v1.10.5/fonts/LICENSE → ...rap/bootstrap-icons-v1.11.3/fonts/LICENSE
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
Binary file added
BIN
+172 KB
packages/yew-bootstrap/bootstrap-icons-v1.11.3/fonts/bootstrap-icons.woff
Binary file not shown.
Binary file added
BIN
+127 KB
packages/yew-bootstrap/bootstrap-icons-v1.11.3/fonts/bootstrap-icons.woff2
Binary file not shown.
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
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 |
---|---|---|
|
@@ -71,7 +71,7 @@ | |
//! | ||
//! ```html | ||
//! <base data-trunk-public-url /> | ||
//! <link rel="stylesheet" href="bootstrap-icons-v1.10.5/bootstrap-icons.css" /> | ||
//! <link rel="stylesheet" href="bootstrap-icons-v1.11.3/bootstrap-icons.css" /> | ||
//! <link data-trunk rel="rust" data-bin="name-of-app" /> | ||
//! ``` | ||
//! | ||
|
@@ -205,12 +205,25 @@ pub struct BIFiles { | |
pub license: &'static str, | ||
} | ||
|
||
/// 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 { | ||
/// Version of the package. | ||
pub const VERSION: &'static str = "v1.10.5"; | ||
pub const VERSION: &'static str = version!(); | ||
|
||
/// Name of the package. | ||
pub const NAME: &'static str = "bootstrap-icons-v1.10.5"; | ||
pub const NAME: &'static str = concat!("bootstrap-icons-", version!()); | ||
|
||
/// All bootstrap-icons files. | ||
/// | ||
|
@@ -221,20 +234,22 @@ 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.10.5/bootstrap-icons.css"), | ||
font_woff: include_bytes!("../../bootstrap-icons-v1.10.5/fonts/bootstrap-icons.woff"), | ||
font_woff2: include_bytes!("../../bootstrap-icons-v1.10.5/fonts/bootstrap-icons.woff2"), | ||
license: include_str!("../../bootstrap-icons-v1.10.5/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. | ||
/// | ||
/// Call `BIFiles::cdn()` inside the `html!{}` returned by your application. | ||
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">"#, | ||
), | ||
html: AttrValue::Static(concat!( | ||
r#"<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@"#, | ||
version!(), | ||
r#"/font/bootstrap-icons.css">"# | ||
)), | ||
}) | ||
} | ||
|
||
|