Seed is an awesome framework to develop single page applications.
This package provides build.rs
to generate icons to use with Seed.
It does not provide you with icons themselves (you stil have to reference
CSS / JS files from your index.html), but it gives you a module for each icon and it can help you with downloading resources.
[dependencies]
In your Cargo.toml:
toml
seed-icons = "0.3.1"
For example regular check-circle could be imported next way:
rust
use seed_icons::fa::regular::check_circle;
There are three methods in icon module: i
, i_c
, i_s
and i_sc
i
- just renders iconi_c
- renders icon with a list of custom classesi_s
- renders icon with stylei_sc
- renders icon with style and classesFor example call i_s
function could be used like that:
``` rust use seed::{prelude::, *}; use seed_icons::fa::regular::check_circle; use seed_style::;
fn greencheck
Or i_c
with custom CSS:
rust
check_circle::i_c(vec!["green-icon"])
In this case you'd need also to provide CSS somewhere:
css
.green-icon {
color: green;
}
You might want to download resources with icons by yourself, or
you can use seed-icons-gen
crate for that.
In [build-dependencies]
add following:
toml
seed-icons-gen = "0.2.0"
build.rs
If you already have build.rs
, you just need to modify it
to do the same as the following one:
rust
fn main() {
seed_icons_gen::get_fa_resources("static");
}
When your crate would be built, that would download font-awesome
folder inside of static
folder.
You might want to add .gitignore
file in static folder:
.gitignore
font-awesome
, because you'd probably will not want to keep all those
resources in your VCS.
If you've downloaded resources as explained before, then
you can link them in index.html
like that:
html
<link href="static/font-awesome/css/all.css" rel="stylesheet">