feat: adjust `pre` option in webindex to a string instead of an objec… · fuse-box/fuse-box@8d13bd9 · GitHub
More Web Proxy on the site http://driver.im/
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
{{ message }}
This repository was archived by the owner on Jun 20, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: docs/plugins/html/WebIndexPlugin.md
+47-26Lines changed: 47 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -21,29 +21,47 @@ fuse.plugin(
21
21
)
22
22
```
23
23
24
+
Include in the `plugins` array property in the `init` configuration
25
+
26
+
```js
27
+
fuse.init({
28
+
homeDir:'src',
29
+
output:'build/$name.js',
30
+
target:'browser',
31
+
plugins: [
32
+
WebIndexPlugin()
33
+
]
34
+
});
35
+
```
36
+
24
37
## Options
25
38
26
-
| Name | Meaning |
27
-
| ------------- | ------------- |
28
-
|` title `| Sets the title |
29
-
|` bundles `| Provide a list of bundle names (if not set all registered bundles are through) |
30
-
|` path `| The relative url bundles are served from. Default is `/`. Empty is set with `.`|
31
-
|` template `| Provide a path to your own template |
32
-
|` engine `| You can use conslidate plugin by providing an engine name |
33
-
|` locals `| Pass variable to consolidate module |
34
-
|` templateString `| Provide your own template as a string |
35
-
|` target `| The main filename. Default is `index.html`|
36
-
|` resolve `|`resolve ?: {(output : UserOutput) : string}` Allows to completely override the output |
37
-
|`pre `| `{ relType: 'fetch' | 'load' }` Config object to either preload or prefetch the output javascript bundles in the head of the document |
38
-
|` appendBundles `| Append $bundles to provided template |
39
-
|` async `| Provide `async` attribute to `<script>` tags (boolean) |
40
-
|` scriptAttributes `| Provide additional attribute(s) to `<script>` tags (string) |
41
-
42
-
43
-
note: If you specify template and templateString then template will take precedent
39
+
> Note: If a `template` and `templateString` option are both specified, then the `template`
40
+
> will take precedent.
41
+
> If no default value is specified below, the option will not be applied.
42
+
43
+
| Name | Type | Description | Default |
44
+
| -----| ---- | ----------- | -------
45
+
|`appendBundles`|`boolean`| Append the $bundles to provided template |`true`|
46
+
|`async`|`boolean`| Adds the `async` attribute to the `<script />` tags that link the output javascript bundles |`false`|
47
+
|`author`|`string`| Set the the `content` attribute of a `<meta name="author"` tag |
48
+
|`bundles`|`string[]`| Provide a list of bundle names. (if not set all registered bundles are through) |
49
+
|`charset`|`string`| Set the the `charset` attribute of a `<meta />` tag |
50
+
|`description`|`string`| Set the the `content` attribute of a `<meta name="description" />` tag |
51
+
|`emitBundles`|`(bundles: string[]) => string`| Function that returns the list of paths to each output bundle |
52
+
|`engine`|`string`| You can use conslidate plugin by providing an engine name |
53
+
|`keywords`|`string`| Set the the `content` attribute of a `<meta name="keywords" />` tag |
54
+
|`locals`|`{ [key: string]: any }`| Pass variable to consolidate module |
55
+
|`path`|`string`| The relative url that bundles are served from. Empty is set with `"."`|`"/"`|
56
+
|`pre`|`string`| Must be specified using either `'fetch'` or `'load'`. Adds `<link />` tags with `preload` or `prefetch` attributes for each of the output javascript bundles. The tags will be injected into the head of the html document or where specified by the `$pre` macro |
57
+
|`resolve`|`resolve ?: {(output : UserOutput) : string}`| Function that allows to completely override the output |
58
+
|`target`|`string`| The name of the output `.html` file |`index.html`|
59
+
|`template`|`string`| Provide a path to your own template |
60
+
|`templateString`|`string`| Provide your own template |
61
+
|`title`|`string`| Sets the title of the generated HTML document |
44
62
45
63
### Resolve example
46
-
`resolve` option allows you to completely override the path
64
+
The `resolve` option allows you to completely override the path.
47
65
48
66
```js
49
67
WebIndexPlugin({
@@ -54,12 +72,15 @@ WebIndexPlugin({
54
72
55
73
## Custom template
56
74
57
-
A custom template has the following macro available:
75
+
A custom template has the following macros available:
58
76
59
-
|Symbol| Meaning |
77
+
|Macro| Meaning |
60
78
| ------------- | ------------- |
61
-
|` $title `| Html Title |
62
-
|` $bundles `| A list of script tags |
63
-
|` $css `| A list of styles tags |
64
-
65
-
github_example: vendor-splitting
79
+
|`$author`| Define where the author meta tags will be injected into the html document |
80
+
|`$bundles`| A list of script tags |
81
+
|`$charset`| Define where the charset meta tags will be injected into the html document |
82
+
|`$css`| A list of styles tags |
83
+
|`$description`| Define where the description meta tags will be injected into the html document |
84
+
|`$keywords`| Define where the keywords meta tags will be injected into the html document |
85
+
|`$pre`| Define where the prefetch/preload link tags will be injected into the html document |
0 commit comments