Crate perseus_cli
source · [−]Expand description
Perseus
Perseus is a blazingly fast frontend web development framework built in Rust with support for generating page state at build-time, request-time, incrementally, or whatever you’d like! It supports reactivity using Sycamore, and builds on it to provide a fully-fledged framework for developing modern apps.
- 📕 Supports static generation (serving only static resources)
- 🗼 Supports server-side rendering (serving dynamic resources)
- 🔧 Supports revalidation after time and/or with custom logic (updating rendered pages)
- 🛠️ Supports incremental regeneration (build on demand)
- 🏭 Open build matrix (use any rendering strategy with anything else)
- 🖥️ CLI harness that lets you build apps with ease and confidence
- 🌐 Full i18n support out-of-the-box with Fluent
- 🏎 Lighthouse scores of 100 on desktop and over 95 on mobile
- ⚡ Support for hot state reloading (reload your entire app’s state after you make any code changes in development, Perseus is the only framework in the world that can do this, to our knowledge)
Usage
Here’s a taste of Perseus (see the tiny example for more):
use perseus::{Html, PerseusApp, Template};
use sycamore::view;
#[perseus::main]
pub fn main<G: Html>() -> PerseusApp<G> {
PerseusApp::new().template(|| {
Template::new("index").template(|_| {
view! {
p { "Hello World!" }
}
})
})
}
Check out the book to learn how to turn that into your next app!
Aim
Support every major rendering strategy and provide developers the ability to efficiently create super-fast apps with Rust and a fantastic developer experience!
Motivation
There is a sore lack of Rust frameworks for frontend development that support more than just SPAs and client-side rendering, and so Perseus was born. We need something like NextJS for Wasm (but why stop there?).
Contributing
We appreciate all kinds of contributions, check out our contributing guidelines for more information! Also, please be sure to follow our code of conduct.
You can also chat about Perseus on our channel on Sycamore’s Discord server.
License
See LICENSE.
Packages
This is the API documentation for the perseus-cli package, which acts as a frontend for abstracting away a lot of Perseus’ internal complexity. Note that Perseus mostly uses
the book for documentation, and this should mostly be used as a secondary reference source. You can also find full usage examples
here.
Why is this here?
Usually, binary packages wouldn’t have API documentation like this, but the Perseus CLI uses a hybrid structure of a library and a binary, which allows it to be used as a library in applications that build on Perseus. Note that this area of using Perseus is currently almost entirely undocumented, and there may be major hiccups! If you’d like to help us out, please open a PR for the documentation you’d like to see on this front!
Modules
Constants
Functions
cargo and wasm-pack). These can all be checked
by just trying to run their binaries and looking for errors. If the user has other paths for these, they can define them under the
environment variables PERSEUS_CARGO_PATH and PERSEUS_WASM_PACK_PATH..perseus/dist/static or .perseus/dist/pkg and replaces the directory.pkg/ directory (can be changed with -o/--output). This will build everything for release and then
put it all together in one folder that can be conveniently uploaded to a server, file host, etc. This can return any kind of error
because deploying involves working with other subcommands..perseus/ from
the user’s .gitignore and add a file .ejected to .perseus/.clean should fail unless --force is provided.PERSEUS_USE_RELOAD_SERVER is set to true..perseus/ subcrates. We use these subcrates to do all the building/serving, we just
have to execute the right commands in the CLI. We can essentially treat the subcrates themselves as a blackbox of just a folder.dbg! and
the like in their builder functions.