Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port todomvc project to use Trunk. #302

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ target/
node_modules/
.idea/
pkg/
dist/
cargo-timing*.html
**/cypress/screenshots
**/cypress/videos
**/cypress/videos
7 changes: 2 additions & 5 deletions dom/examples/todo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ Commands all assume the working directory is the repository root.

## Serving

Build the example and start the project's local HTTP server:
First install [Trunk](https://trunkrs.dev/).

```
$ cargo build-dom-todo # for live-watching rebuilds use `cargo dom-flow`
$ cargo ofl serve
$ trunk serve
```

In VSCode the same can be accomplished by running the `dom crates` and `project server` tasks.

## Using

To use the example locally, follow the directions for [serving](#serving) the project and
Expand Down
10 changes: 1 addition & 9 deletions dom/examples/todo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@
<p>Created by <a href="http://blog.anp.lol">anp</a></p>
<p>Part of <a href="http://moxie.rs">moxie-dom</a></p>
</footer>

<script type="module">
import init, { boot } from './pkg/index.js';
(async () => {
await init();
await boot(document.querySelector('#content'));
})();
</script>
</body>

</html>
</html>
2 changes: 2 additions & 0 deletions dom/examples/todo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ pub fn setup_tracing() {
info!("tracing initialized");
});
console_error_panic_hook::set_once();
use moxie_dom::raw::sys::window;
boot(window().unwrap().document().unwrap().get_element_by_id("content").unwrap().into());
}

#[wasm_bindgen]
Expand Down