Crabsburger
Crabsburger is a project that showcases the capabilities of Dioxus, a powerful Rust library for building user interfaces. This project serves as both a practical example of a commercial website implementation and a learning resource for developers interested in Rust-based web development.
Install / Use
/learn @RustGrow/CrabsburgerREADME
Crabsburger Example
Welcome to the Crabsburger example food landing page site for the Dioxus community!
<div align="center"> <h3> <a href="https://crabsburger.netlify.app/"> Website </a> </h3> </div>About This Example
This example showcases the new syntax introduced in Dioxus 0.6 and utilizes signals as the state management approach. It's designed to demonstrate best practices and provide a reference for building your own Dioxus applications.
Features
- Utilizes the new syntax of Dioxus 0.6.3
- State management with signals
- Styling with Tailwind CSS v3.4
Roadmap
- [X] Create a button that appears when scrolling the page
- [X] Highlight the top menu when scrolling
- [X] Implement light and dark mode toggling and set the mode in the HTML tag as required by Tailwind CSS
- [X] Save the color scheme to the browser's local storage
- [X] Retrieve the browser client's language
- [X] Change the language in the HTML tag when switching languages
Important. This project uses the web platform
Quick start
- Reinstall the CLI to the git version. For Windows users need to install the Netwide Assembler (NASM). On startup it will open the shell and inside execute this command.
cargo install --git https://github.com/dioxuslabs/dioxus dioxus-cli --locked --force
or you can install the CLI (instead of building from source) use:
cargo binstall dioxus-cli --force
- Clone this repository
https://github.com/DioxusGrow/crabsburger.git
and 👇
Development
- Install npm: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
- Install the tailwind css cli: https://tailwindcss.com/docs/installation
- Run the following command in the root of the project to start the tailwind CSS compiler:
npx tailwindcss -i ./input.css -o ./assets/tailwind.css --watch
Run the following command in the root of the project to start the Dioxus dev server:
dx serve
- Open the browser to http://localhost:8080
How to use the Dioxus cli version from github
It often happens that a necessary update is released or fix bugs in a minor version of a project. In this case you can use the github version of cli.
- Reinstall the CLI:
cargo install --git https://github.com/dioxuslabs/dioxus dioxus-cli --locked --force
- Check Dioxus cli version
dx -V
// dioxus 0.6.3 (bdeedc1)
- Add dependencies to the Cargo.toml file. The Dioxus version from github must match the cli version. In this case it is rev = "bdeedc1"
[dependencies]
dioxus = { git = "https://github.com/DioxusLabs/dioxus", rev = "bdeedc1" features = ["router"] }
dioxus-logger = "0.5.1"
[features]
default = ["web"]
web = ["dioxus/web"]
desktop = ["dioxus/desktop"]
mobile = ["dioxus/mobile"]
-
For existing projects, to synchronize with cli, you must also run the command
cargo update -
Start the Tailwind CSS compiler and the Dioxus dev server in different terminals:
npx tailwindcss -i ./input.css -o ./assets/tailwind.css --watch
You can start web version by default:
dx serve
or with platform
dx serve --platform web
And you can start desktop version:
dx serve --platform desktop
If you need a local stylesheet for custom styles inside input.css.
- Insert your custom styles inside input.css:
@layer components {
p {
@apply p-10 bg-yellow-600;
}
.red {
@apply bg-red-600;
}
.yellow {
@apply bg-yellow-600;
}
.blue {
@apply bg-blue-600;
}
}
- Insert custom classes into the page:
rsx!{
p { "I" }
div { class: "red", "want to" }
div { class: "yellow", "burger" }
div { class: "blue", "burger" }
}
- Rebuild the app:
button r on terminal
or
dx serve
How to make a release
- Make sure you add the languages folder to the monitoring in the Dioxus.toml file:
# which files or dirs will be watcher monitoring
watch_path = ["src", "assets", "lang"]
- Use the
dx checkcommand to check that there are no errors in the logic for using the signals.
dx check
//output No issues found.
- Make a release for web:
dx build --release --platform web
for desktop:
dx build --release --platform desktop
- The release is inside
/target/dx/fustfood/release/web/publicfolder is by default the main project folder where the finished site is located.
Netlify deployment
Deploying an application in netlify requires a special settings file to be uploaded to the assets folder so that it is automatically loaded when the project is built. In this repository it is already in the assets folder.
netlify.toml
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
License
This project is open source and available under the MIT License.
Related Skills
himalaya
345.9kCLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
taskflow
345.9kname: taskflow description: Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layer
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
