Cargo Features

[dependencies]
perseus = { version = "0.4.2", default-features = false, features = ["translator-fluent", "translator-lightweight", "suspended-interaction", "macros", "dflt-engine", "client-helpers", "minify", "minify-js", "minify-css", "cache-initial-load", "hydrate", "preload-wasm-on-redirect", "idb-freezing", "wasm2js", "live-reload", "hsr", "rx-collections"] }
default = cache-initial-load, client-helpers, dflt-engine, hsr, live-reload, macros, minify, minify-css

Live reloading will only take effect in development, and won't impact production BUG This adds 1.9kB to the production bundle (that's without size optimizations though)

translator-fluent = fluent-bundle, intl-memoizer, unic-langid
translator-lightweight
suspended-interaction

Suspends all click events at the document root until Perseus is fully loaded, then passing them through.

macros default = perseus-macro

This feature adds support for a number of macros that will make your life MUCH easier (read: use this unless you have very specific needs or are completely insane)

dflt-engine default

This feature enable support for functions that make using the default engine configuration much easier.

client-helpers default = console_error_panic_hook

This features enables client-side helpers designed to be run in the browser.

Affects perseus::client

minify default minify-css minify-js?

This feature enables the minification of HTML, CSS, and JS assets, improving your page load speeds. You should only disable this if you're having issues with invalid HTML.

minify-js = minify
minify-css default = minify
cache-initial-load default

This feature enables caching of pages that are loaded through the initial loads system (i.e. the first one the user goes to on your site); this involves making a (usually excellent) guess at the contents of the <head> on that page. If you perform any advanced manipulation of the <head> such that loading a page from scratch, going somewhere else, and then going back to it breaks something, disable this.

hydrate

This feature enables Sycamore hydration by default (Sycamore hydration feature is always activated though) This is not enabled by default due to some remaining bugs (also, default features in Perseus can't be disabled without altering .perseus/)

Affects perseus::PerseusNodeType

preload-wasm-on-redirect

This feature enables the preloading of the Wasm bundle for locale redirections, which in theory improves UX For now, this is experimental until it can be tested in the wild (local testing of this is extremely difficult for UX, we need real world metrics)

idb-freezing hsr = rexie

This exposes an API for saving frozen state to IndexedDB simply, with options for making your storage persistent so the browser won't delete it

Enables StorageManager of web-sys

wasm2js

Switches to expecting the server to provide a JS bundle that's been created from Wasm Note that this is highly experimental, and currently blocked by rustwasm/wasm-bindgen#2735 This is deliberately undocumented in lib.rs!

live-reload default hsr = js-sys

Enables automatic browser reloading whenever you make a change

Enables BinaryType, ErrorEvent, Location, MessageEvent and WebSocket of web-sys

hsr default = idb-freezing, live-reload

Enables hot state reloading, whereby your entire app's state can be frozen and thawed automatically every time you change code in your app

rx-collections

Enables reactive versions of common Rust collections, like Vec<T> and HashMap<K, V>. (Note that RxResult is always present, as it's needed for suspended state.)

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

perseus-macro macros
fluent-bundle translator-fluent?
unic-langid translator-fluent?
intl-memoizer translator-fluent?
console_error_panic_hook client clientdoc client-helpers
js-sys client clientdoc live-reload
rexie client clientdoc idb-freezing?

Enables rexie ^0.4