You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library provides a lightweight [backend integration](https://vitejs.dev/guide/backend-integration.html)
8
-
for your PHP-based MPA, SPA or PWA based on [Vite](https://vitejs.dev/).
8
+
for your PHP-based MPA, SPA, or PWA based on [Vite](https://vitejs.dev/).
9
9
10
10
It parses the [build manifest](https://vitejs.dev/config/build-options#build-manifest) (the `.vite/manifest.json` file)
11
11
and produces the required `<script>` and `<link>` tags to load (and preload) scripts, CSS files, and other assets.
12
12
13
13
## Basic Usage
14
14
15
15
A commented MPA example is available [here](https://github.com/mindplay-dk/php-vite-mpa) -
16
-
please refer to this for examples of configuring Vite, NPM, TypeScript and Composer.
16
+
please refer to this for examples of configuring Vite, NPM, TypeScript, and Composer.
17
17
18
18
In the following steps, we'll cover usage of the library API only.
19
19
@@ -27,13 +27,13 @@ $vite = new Manifest(
27
27
);
28
28
```
29
29
30
-
Teh`manifest_path` points to the Vite `manifest.json` file created for the production build.
30
+
The`manifest_path` points to the Vite `manifest.json` file created for the production build.
31
31
32
32
In this example, `dev` is `false`, so we'll be creating tags for the production assets.
33
33
34
34
The `base_path` is relative to your public web root - it is the root folder from which Vite's production assets are served, and/or the root folder from which Vite serves assets dynamically in development mode.
35
35
36
-
Note that, in development mode (when `dev` set to `false`) the `manifest.json` file is unused, and not required.
36
+
Note that, in development mode (when `dev`is set to `true`) the `manifest.json` file is unused, and not required.
37
37
38
38
> 💡 *For a detailed description of the constructor arguments, please refer to the `Manifest` constructor argument doc-blocks.*
39
39
@@ -55,7 +55,7 @@ Making multiple calls for different entry points *may* result in duplicate tags
55
55
56
56
#### 3. Emit from `Tags` in your HTML template:
57
57
58
-
Your `Tags` instance contains the `preload` and `css` tags, which should be emitted in
58
+
Your `Tags` instance contains the `preload` and `CSS` tags, which should be emitted in
59
59
your `<head>` tag, as well as the `js` tags, which should be emitted immediately before
60
60
the `</body>` end tag.
61
61
@@ -105,13 +105,13 @@ Then create your tags as covered in the documentation above.
105
105
106
106
## Creating URLs
107
107
108
-
For advanced use-cases, you can also directly get the URL for an asset published by Vite:
108
+
For advanced usecases, you can also directly get the URL for an asset published by Vite:
109
109
110
110
```php
111
111
$my_url = $manifest->getURL("consent-banner.ts");
112
112
```
113
113
114
114
You can use this feature to, for example:
115
115
116
-
* Create your own custom preload tags (e.g. with media-queries)
116
+
* Create your own custom preload tags (e.g. with mediaqueries)
117
117
* Conditionally load a script based on user interactions or user state, etc.
0 commit comments