Skip to content

Commit

Permalink
Refactor to separate examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
isosphere committed Feb 23, 2023
1 parent e47a8db commit e95ae06
Show file tree
Hide file tree
Showing 29 changed files with 754 additions and 41 deletions.
46 changes: 8 additions & 38 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,38 +1,8 @@
[package]
name = "yew-bootstrap"
version = "0.5.4"
authors = ["Matthew Scheffel <[email protected]>", "Foorack <[email protected]>"]
edition = "2021"
license = "MIT"
readme = "README.md"
keywords = ["yew", "bootstrap", "web"]
categories = ["gui", "web-programming"]
description = "Components for easier using Bootstrap with Yew"
repository = "https://github.com/foorack/yew-bootstrap/"

[[bin]]
name = "yew-bootstrap-example"
path = "src/example.rs"

[lib]
# You should include "rlib" (the default crate type) otherwise your crate can't be used as a Rust library
# which, among other things, breaks unit testing
crate-type = ["rlib", "cdylib"]
name = "yew_bootstrap"

[dependencies]
yew = { version = "0.20", features = ["csr"] }
log = "0.4"
#console_log = { version = "0.2", features = ["color"] }

[profile.release]
# less code to include into binary
panic = 'abort'
# optimization over all codebase ( better optimization, slower build )
codegen-units = 1
# optimization for size ( more aggressive )
opt-level = 'z'
# optimization for size
# opt-level = 's'
# link time optimization using using whole-program analysis
lto = true
[workspace]
members = [
"packages/*"
]
exclude = [
"examples/*",
]
resolver = "2"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Add the dependency next to the regular yew dependency:
```toml
[dependencies]
yew = "0.20"
yew-bootstrap = "0.5.4"
yew-bootstrap = "0.5"
```

Then in the beginning of your application, include the `include_cdn()` or `include_inline()` function to load the required CSS. Some components require the Bootstrap JavaScript
Expand All @@ -34,7 +34,7 @@ library to be loaded - for these you can use the `include_cdn_js()` function. It
Check `main.rs` for example usage for every implemented component.

## Version Convention
`0.xy`
`0.x.y`
Versions that have the same `x` value target the same version of Yew.

There is currently no indication of which version of Bootstrap is targeted, however, we’ll try to target the previous release pipeline. For example as of this writing the latest boostrap is 5.2.x, so we’ll try to target the latest 5.1.x version.
Expand Down
15 changes: 15 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[workspace]
members = [
"*",
]
exclude = [
"target",
".cargo"
]
resolver = "2"

[profile.release]
lto = true
codegen-units = 1
panic = "abort"
opt-level = "z"
20 changes: 20 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Yew Bootstrap Examples

## How to run

The examples are built with [trunk](https://github.com/thedodd/trunk) which you can install with the following command:

```bash
cargo install --locked trunk
```

Running an example is as easy as running a single command in the appropriate directory:

```bash
# move into the directory of the example you want to run
# In this case it's the todomvc example
cd examples/basics

# build and serve the example
trunk serve --release
```
10 changes: 10 additions & 0 deletions examples/basics/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "basics"
version = "0.1.0"
authors = ["Matthew Scheffel <[email protected]>", "Foorack <[email protected]>"]
edition = "2021"
license = "MIT"

[dependencies]
yew = { version = "0.20", features = ["csr"] }
yew-bootstrap = { path = "../../packages/yew-bootstrap" }
Loading

0 comments on commit e95ae06

Please sign in to comment.