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
//! Example with `base` option.
//!
//! ```shell
//! cargo run --example options-base
//! ```
// Most of the time you change location of your static assets.
//
// For this example, we'll add `/assets` base (AKA path prefix).
//
// 1. First things first, change base in the vite project.
//
// Go to your vite project, `vite.config.js` and add `base` option:
//
// ```diff
// // <snip>
// export default defineConfig({
// + base: "/assets",
// build: {
// manifest: true,
// // <snip>
// }
// })
// ```
//
// Now, all rendered paths will have `/assets` base.
//
// ...continued below
use Manifest;
// ...
// 2. Modify the macro, by adding `#[base = "..."]` option:
// NOTE: this is same as `#[base = "/static/"]` and `#[base = "assets"]`
;
// Done!
//
// This example only shows, how to add this option.
// When you use manifest as usual, you will see that output paths (`ManifestChunk.file`) are not prefixed with base.
//
// So the fix is to prefix manually in integrations.
//
// `HtmlIntegration` prefixes all paths with `base` and `ActixFiles` service uses `base`
// as root path.