@modern-js/main-doc 0.0.0-next-1681926671191 → 0.0.0-next-1681963428820
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/docs/en/guides/basic-features/html.mdx +38 -38
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @modern-js/main-doc
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-1681963428820
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
- Updated dependencies [fefd1c564]
|
|
16
16
|
- Updated dependencies [1f34dbae9]
|
|
17
17
|
- Updated dependencies [b965df261]
|
|
18
|
-
- @modern-js/builder-doc@0.0.0-next-
|
|
18
|
+
- @modern-js/builder-doc@0.0.0-next-1681963428820
|
|
19
19
|
|
|
20
20
|
## 2.13.4
|
|
21
21
|
|
|
@@ -48,6 +48,8 @@ These components are rendered:
|
|
|
48
48
|
|
|
49
49
|
- `Scripts`: The script content generated by the webpack, which can be used to adjust the position of the bundle result, is placed in the `<Head>` component by default.
|
|
50
50
|
|
|
51
|
+
- `Comment`: Make the comment like `<!-- gateway -->`, could be stay to the html that final render.
|
|
52
|
+
|
|
51
53
|
### Template Params
|
|
52
54
|
|
|
53
55
|
Because it is in the form of JSX, in `Document.[jt]sx`, you can use various variables in the component to assign values to various custom components more freely.
|
|
@@ -68,8 +70,8 @@ import {
|
|
|
68
70
|
Root,
|
|
69
71
|
Head,
|
|
70
72
|
Body,
|
|
71
|
-
Scripts,
|
|
72
73
|
DocumentContext,
|
|
74
|
+
Comment,
|
|
73
75
|
} from '@modern-js/runtime/document';
|
|
74
76
|
|
|
75
77
|
export default function Document(): React.ReactElement {
|
|
@@ -83,13 +85,14 @@ export default function Document(): React.ReactElement {
|
|
|
83
85
|
return (
|
|
84
86
|
<Html>
|
|
85
87
|
<Head>
|
|
86
|
-
<link href="https://modernjs.dev"
|
|
88
|
+
<link href="https://modernjs.dev" />
|
|
89
|
+
<Comment>{'<!-- Need a Comment -->'}</Comment>
|
|
87
90
|
</Head>
|
|
88
91
|
<Body>
|
|
89
92
|
<Root rootId="root">
|
|
90
93
|
<h1 style={{ color: 'red' }}>Some Params: </h1>
|
|
91
|
-
<h2> entryName
|
|
92
|
-
<h2> title
|
|
94
|
+
<h2> entryName:{entryName}</h2>
|
|
95
|
+
<h2> title:{htmlConfig.title}</h2>
|
|
93
96
|
<h2> rootId: {templateParams.mountId}</h2>
|
|
94
97
|
</Root>
|
|
95
98
|
<h1>bottom</h1>
|
|
@@ -104,49 +107,46 @@ The above JSX component will generate the following HTML template:
|
|
|
104
107
|
```html
|
|
105
108
|
<!DOCTYPE html>
|
|
106
109
|
<html>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<meta
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<meta
|
|
114
|
-
<meta name="
|
|
115
|
-
<meta name="
|
|
116
|
-
<meta name="
|
|
117
|
-
<meta name="
|
|
118
|
-
<
|
|
119
|
-
<script>
|
|
120
|
-
...
|
|
121
|
-
</script>
|
|
110
|
+
|
|
111
|
+
<head>
|
|
112
|
+
<meta charset="utf-8">
|
|
113
|
+
<meta name="viewport"
|
|
114
|
+
content="width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
115
|
+
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
116
|
+
<meta name="renderer" content="webkit">
|
|
117
|
+
<meta name="layoutmode" content="standard">
|
|
118
|
+
<meta name="imagemode" content="force">
|
|
119
|
+
<meta name="wap-font-scale" content="no">
|
|
120
|
+
<meta name="format-detection" content="telephone=no">
|
|
121
|
+
<link rel="icon" href="/a.icon">
|
|
122
|
+
<script defer src="/static/js/builder-runtime.js"></script>
|
|
122
123
|
<script defer src="/static/js/lib-react.js"></script>
|
|
123
124
|
<script defer src="/static/js/lib-polyfill.js"></script>
|
|
124
125
|
<script defer src="/static/js/lib-router.js"></script>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<script
|
|
130
|
-
defer
|
|
131
|
-
src="/static/js/packages_runtime_plugin-router-legacy_dist_js_treeshaking_runtime_index_js-packages_runtime_p-28f4c9.js"
|
|
132
|
-
></script>
|
|
126
|
+
|
|
127
|
+
<script>
|
|
128
|
+
...
|
|
129
|
+
</script>
|
|
133
130
|
<script defer src="/static/js/sub.js"></script>
|
|
134
|
-
<link href="https://
|
|
135
|
-
|
|
131
|
+
<link href="https://modernjs.dev" />
|
|
132
|
+
<!-- Need a Comment -->
|
|
133
|
+
</head>
|
|
136
134
|
|
|
137
|
-
|
|
135
|
+
<body>
|
|
138
136
|
<div id="root">
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
<!--<?- html ?>-->
|
|
138
|
+
<h1 style="color:red">Some Params: </h1>
|
|
139
|
+
<h2> entryName:sub</h2>
|
|
140
|
+
<h2> title:</h2>
|
|
141
|
+
<h2> rootId: root</h2>
|
|
144
142
|
</div>
|
|
145
143
|
<h1>bottom</h1>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
<!--<?- chunksMap.js ?>-->
|
|
145
|
+
<!--<?- SSRDataScript ?>-->
|
|
146
|
+
</body>
|
|
147
|
+
|
|
149
148
|
</html>
|
|
149
|
+
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
## Html Synxtax
|
package/package.json
CHANGED
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"modern",
|
|
12
12
|
"modern.js"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.0.0-next-
|
|
14
|
+
"version": "0.0.0-next-1681963428820",
|
|
15
15
|
"publishConfig": {
|
|
16
16
|
"registry": "https://registry.npmjs.org/",
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@modern-js/builder-doc": "0.0.0-next-
|
|
20
|
+
"@modern-js/builder-doc": "0.0.0-next-1681963428820"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"classnames": "^2",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"fs-extra": "^10",
|
|
30
30
|
"@types/node": "^16",
|
|
31
31
|
"@types/fs-extra": "^9",
|
|
32
|
-
"@modern-js/builder-doc": "0.0.0-next-
|
|
33
|
-
"@modern-js/doc-
|
|
34
|
-
"@modern-js/doc-
|
|
32
|
+
"@modern-js/builder-doc": "0.0.0-next-1681963428820",
|
|
33
|
+
"@modern-js/doc-plugin-auto-sidebar": "0.0.0-next-1681963428820",
|
|
34
|
+
"@modern-js/doc-tools": "0.0.0-next-1681963428820"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "modern dev",
|