1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! Getting started example.
//!
//! There's also no yapping version at `getting-started-no-yap.rs`.
//!
//! ```shell
//! cargo run --example getting-started
//! ```
use Manifest;
// To add vite static, we need to create struct and add `vite_static::Manifest` derive.
// `Manifest` derive macro has options, such as vite_dist, base, etc.
// Look into documentation, if you want to see all options and descriptions for them.
// ---
// Now, we need to give path to Vite project's `dist/` folder.
// You can specify relative path (relative to Cargo.toml):
// Or you can specify absolute path:
// #[vite_dist = "/absolute/path/to/dist"]
// Or you can use environment variables to specify path:
// #[vite_dist = "env:MY_VITE_STATIC_PATH"]
// (BTW, `env:` syntax supports default values after vertical bar!)
// #[vite_dist = "env:MY_VITE_STATIC_PATH|examples/vite-project/dist"]
// ---
// RECOMMENDED!
// ^ to learn more, see `options/no-embedding.rs` example
// ^ tl;dr - it will NOT embed manifest and chunks in debug builds.
// ---
// This option is required, because we changed base path in `vite-project/vite.config.js`.
;
// Now we are ready to use `MyViteStatic` struct!