pub struct EntryAssets {
pub script: String,
pub stylesheets: Vec<String>,
}Expand description
Resolved asset paths for the JS entry point of a Vite project.
In dev mode, script points at the raw source file (src/main.tsx)
and stylesheets is empty — Vite injects CSS via the JS module at runtime.
In production, both are read from dist/.vite/manifest.json and carry
the content hash (e.g. assets/main-A1b2C3.js).
Obtain an instance via ViteConfig::entry_assets.
§Example
use axum_vite::{ViteConfig, embedded_dir, frameworks::Framework};
let config = ViteConfig {
framework: Framework::React,
..ViteConfig::from_env(embedded_dir!("$CARGO_MANIFEST_DIR/frontend/dist"))
};
let entry = config.entry_assets();
// entry.script → "/static/src/main.tsx" (dev)
// → "/static/assets/main-A1b2C3.js" (release)
// entry.stylesheets → [] (dev)
// → ["/static/assets/index-B2c3.css"] (release)Fields§
§script: StringValue for <script type="module" src="…">.
stylesheets: Vec<String>Values for <link rel="stylesheet" href="…"> tags.
Trait Implementations§
Source§impl Clone for EntryAssets
impl Clone for EntryAssets
Source§fn clone(&self) -> EntryAssets
fn clone(&self) -> EntryAssets
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EntryAssets
impl Debug for EntryAssets
Source§impl Default for EntryAssets
impl Default for EntryAssets
Source§fn default() -> EntryAssets
fn default() -> EntryAssets
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EntryAssets
impl RefUnwindSafe for EntryAssets
impl Send for EntryAssets
impl Sync for EntryAssets
impl Unpin for EntryAssets
impl UnsafeUnpin for EntryAssets
impl UnwindSafe for EntryAssets
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more