{"id":13804794,"url":"https://github.com/panoptix-za/web-bundler","last_synced_at":"2025-05-13T18:32:50.117Z","repository":{"id":48921635,"uuid":"326944026","full_name":"panoptix-za/web-bundler","owner":"panoptix-za","description":"Bundles a Rust WebAssembly frontend application for publishing","archived":false,"fork":false,"pushed_at":"2023-10-11T19:52:21.000Z","size":54,"stargazers_count":11,"open_issues_count":4,"forks_count":3,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-09T15:54:20.110Z","etag":null,"topics":["build-script","cargo","frontend","rust","seed","wasm","wasm-pack","web"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/panoptix-za.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-01-05T09:06:53.000Z","updated_at":"2023-09-30T18:22:23.000Z","dependencies_parsed_at":"2024-04-09T21:47:43.936Z","dependency_job_id":"99d92f05-6ea6-44a4-88c6-31e17344ce4f","html_url":"https://github.com/panoptix-za/web-bundler","commit_stats":{"total_commits":47,"total_committers":4,"mean_commits":11.75,"dds":0.4893617021276596,"last_synced_commit":"e441c9415dc5043df91e3d534af0c7d8ca1a6f7d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panoptix-za%2Fweb-bundler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panoptix-za%2Fweb-bundler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panoptix-za%2Fweb-bundler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/panoptix-za%2Fweb-bundler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/panoptix-za","download_url":"https://codeload.github.com/panoptix-za/web-bundler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253475629,"owners_count":21914439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-script","cargo","frontend","rust","seed","wasm","wasm-pack","web"],"created_at":"2024-08-04T01:00:54.003Z","updated_at":"2025-05-13T18:32:49.759Z","avatar_url":"https://github.com/panoptix-za.png","language":"Rust","funding_links":[],"categories":["Bundlers"],"sub_categories":[],"readme":"Web Bundler\n===========\n\n[![crates.io](https://img.shields.io/crates/v/web-bundler.svg)](https://crates.io/crates/web-bundler)\n[![status-badge](https://ci.codeberg.org/api/badges/worthe-it/web-bundler/status.svg)](https://ci.codeberg.org/worthe-it/web-bundler)\n\nManages the building of WebAssembly single page app frontends from a\nbuild.rs script so that they can easily be embedded into Rust API\nprojects.\n\nInternally, the bundler uses\n[wasm-pack](https://github.com/rustwasm/wasm-pack) to do the actual\nwebassembly compilation.\n\n## Prerequisites\n\nFrom a clean Rustup-based Rust installation, there are no additional\nsteps. Web Bundler will download and install any dependencies it\nneeds.\n\nFor Rust installations that are not done with Rustup, you will need to\nadd the `wasm32-unknown-unknown` compilation target manually (see the\n[wasm-pack docs](https://rustwasm.github.io/docs/wasm-pack/prerequisites/non-rustup-setups.html)\nfor details on how to do this).\n\n## Running the Demo Example\n\nThere is an example usage in the [example directory](./example). To\nrun the example, open a terminal in the example directory and run\n`cargo run`. Then, open a web browser and navigate to\n\u003chttp://localhost:3030/\u003e. You should see a Seed web application.\n\n## Usage\n\nWeb-bundler expects you to have two projects: a frontend project using\na single page app framework (like [Seed]), and a backend project using a\nweb server framework (like [warp]).\nThese projects should be in a common\nworkspace.\n\n### Changes to your frontend project\n\n1. Update your index.html to allow templating in Javascript and CSS.\n\n   Specifically, you need to add `{{ stylesheet | safe }}` to the\n   `\u003chead\u003e` section, and `{{ javascript | safe }}` to the end of the\n   `\u003cbody\u003e`. Optionally, if you want to set the base url, add `\u003cbase\n   href=\"{{ base_url }}\"\u003e` to the `\u003chead\u003e` as well.\n\n   See the example [frontend index.html](./example/frontend/index.html).\n\n2. Create a root stylesheet for your app called `./css/style.scss`.\n\n   This stylesheet will be compiled to CSS, and embedded directly into\n   your index.html file.\n\n   See the example [frontend style.scss](./example/frontend/css/style.scss).\n\n3. Put all of your static assets in the `static` directory\n\n   All files in the static directory will be copied directly to a static\n   folder in the output directory.\n\n   See the example [frontend static directory](./example/frontend/static/).\n\n### Changes to your API project\n\n1. Update your Cargo.toml to depend on your frontend project and web-bundler\n\n   We depend on the frontend project in Cargo.toml so that Cargo knows to\n   rerun build.rs whenever the frontend project changes.\n\n   See the example [backend Cargo.toml](./example/backend/Cargo.toml).\n\n2. Add a build.rs script that calls web-bundler for your frontend\n\n   See the example [backend build.rs](./example/backend/build.rs).\n\n3. Use [Rust Embed](https://lib.rs/crates/rust-embed) to embed your built frontend into your API binary\n\n   See the example [backend main.rs](./example/backend/main.rs). Our\n   example uses the [warp web server][warp]. Rust Embed also has examples for\n   other web servers in [their repo](https://github.com/pyros2097/rust-embed/tree/master/examples).\n\n## target and web-target directories\n\nWhen web-bundler compiles the frontend, it overrides the default\ntarget directory to be `web-target` instead of `target`. This is done\nbecause, if the backend and frontend are in the same workspace, Cargo\nwill already be locking `target` while running the build.rs\nscript.\n\n[warp]: https://github.com/seanmonstar/warp\n[Seed]: https://github.com/seed-rs/seed\n\n#### License\n\n\u003csup\u003e\nLicensed under either of\n\u003ca href=\"LICENSE-APACHE\"\u003eApache License, Version 2.0\u003c/a\u003e\nor\n\u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e\nat your option.\n\u003c/sup\u003e\n\n\u003cbr\u003e\n\n\u003csub\u003e\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in this crate by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanoptix-za%2Fweb-bundler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpanoptix-za%2Fweb-bundler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpanoptix-za%2Fweb-bundler/lists"}