[][src]Struct web_bundler::WebBundlerOpt

pub struct WebBundlerOpt {
    pub src_dir: PathBuf,
    pub dist_dir: PathBuf,
    pub tmp_dir: PathBuf,
    pub base_url: Option<String>,
    pub wasm_version: String,
    pub release: bool,
    pub workspace_root: PathBuf,
    pub additional_watch_dirs: Vec<PathBuf>,
}

Bundles a Seed SPA web application for publishing

  • This script will run wasm-pack for the indicated crate.
  • An index.html file will be read from the src_dir, and processed with the Tera templating engine.
  • The .wasm file is versioned.
  • Files in ./static are copied to the output without modification.
  • Files with a .scss extension in ./css are compiled to css.

Example index.html

<!DOCTYPE html>
<html lang="en">
    <head>
        <base href="{{ base_url }}">
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

        {{ stylesheet | safe }}

        <title>My Amazing Website</title>
    </head>
    <body>
        <div id="app"></div>
        {{ javascript | safe }}
    </body>
</html>

Fields

src_dir: PathBuf

Where to look for input files. Usually the root of the SPA crate.

dist_dir: PathBuf

The directory where output should be written to. In build.rs scripts, this should be read from the "OUT_DIR" environment variable.

tmp_dir: PathBuf

A directory that web-bundler can use to store temporary artifacts.

base_url: Option<String>

Passed into the index.html template as base_url. Example template usage: <base href="{{ base_url }}">

wasm_version: String

Rename the webassembly bundle to include this version number.

release: bool

Build in release mode, instad of debug mode.

workspace_root: PathBuf

Path to the root of the workspace. A new target directory, called 'web-target' is placed there. If you aren't using a workspace, this can be wherever your target directory lives.

additional_watch_dirs: Vec<PathBuf>

Any additional directories that, if changes happen here, a rebuild is required.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,