Skip to content

Commit a0215dc

Browse files
Merge pull request #947 from vitejs/sync-ebfa5935-1
docs(en): merge docs-cn/sync-docs into docs-cn/dev @ ebfa593
2 parents 0121db1 + 3fb1a51 commit a0215dc

File tree

6 files changed

+167
-164
lines changed

6 files changed

+167
-164
lines changed

.vitepress/theme/components/AsideSponsors.vue

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,18 @@ const sponsors = computed(() => {
1818
</script>
1919

2020
<template>
21-
<a
22-
class="viteconf"
23-
href="https://viteconf.org/23/replay?utm=vite-sidebar"
24-
target="_blank"
25-
>
26-
<img width="22" height="22" src="/viteconf.svg" />
21+
<a class="vite-event" href="https://lu.ma/vite" target="_blank">
22+
<img width="22" height="22" src="/logo.svg" />
2723
<span>
28-
<p class="extra-info">Beyond Fast</p>
29-
<p class="heading">ViteConf 2023</p>
30-
<p class="extra-info">Watch the replay!</p>
24+
<p class="extra-info">May 9th, 2024</p>
25+
<p class="heading">Vite Meetup SF</p>
3126
</span>
3227
</a>
3328
<VPDocAsideSponsors v-if="data" :data="sponsors" />
3429
</template>
3530

3631
<style>
37-
.viteconf {
32+
.vite-event {
3833
margin-top: 1rem;
3934
margin-bottom: 1rem;
4035
border-radius: 14px;
@@ -53,35 +48,26 @@ const sponsors = computed(() => {
5348
border: 2px solid var(--vp-c-bg-alt);
5449
transition: border-color 0.5s;
5550
}
56-
.viteconf:hover {
51+
.vite-event:hover {
5752
border: 2px solid var(--vp-c-brand-light);
5853
}
59-
.viteconf img {
54+
.vite-event img {
6055
transition: transform 0.5s;
6156
transform: scale(1.25);
6257
}
63-
.viteconf:hover img {
58+
.vite-event:hover img {
6459
transform: scale(1.75);
6560
}
66-
.viteconf .heading {
67-
background-image: linear-gradient(
68-
120deg,
69-
#b047ff 16%,
70-
var(--vp-c-brand-lighter),
71-
var(--vp-c-brand-lighter)
72-
);
61+
.vite-event .heading {
62+
background-image: var(--vp-home-hero-name-background);
7363
background-clip: text;
7464
-webkit-background-clip: text;
7565
-webkit-text-fill-color: transparent;
7666
}
77-
.viteconf .extra-info {
67+
.vite-event .extra-info {
7868
color: var(--vp-c-text-1);
79-
opacity: 0;
8069
font-size: 0.7rem;
8170
padding-left: 0.1rem;
8271
transition: opacity 0.5s;
8372
}
84-
.viteconf:hover .extra-info {
85-
opacity: 0.9;
86-
}
8773
</style>

guide/build.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,24 +257,26 @@ experimental: {
257257

258258
如果 hash 后的资源和公共文件没有被部署在一起,可以根据该函数的第二个参数 `context` 上的字段 `type` 分别定义各个资源组的选项:
259259

260+
<!-- prettier-ignore-start -->
260261
```ts twoslash
261262
import type { UserConfig } from 'vite'
262263
import path from 'node:path'
263264
const config: UserConfig = {
264-
// ---cut-before---
265-
experimental: {
266-
renderBuiltUrl(filename, { hostId, hostType, type }) {
267-
if (type === 'public') {
268-
return 'https://www.domain.com/' + filename
269-
} else if (path.extname(hostId) === '.js') {
270-
return { runtime: `window.__assetsPath(${JSON.stringify(filename)})` }
271-
} else {
272-
return 'https://cdn.domain.com/assets/' + filename
273-
}
274-
},
265+
// ---cut-before---
266+
experimental: {
267+
renderBuiltUrl(filename, { hostId, hostType, type }) {
268+
if (type === 'public') {
269+
return 'https://www.domain.com/' + filename
270+
} else if (path.extname(hostId) === '.js') {
271+
return { runtime: `window.__assetsPath(${JSON.stringify(filename)})` }
272+
} else {
273+
return 'https://cdn.domain.com/assets/' + filename
274+
}
275275
},
276-
// ---cut-after---
276+
},
277+
// ---cut-after---
277278
}
278279
```
280+
<!-- prettier-ignore-end -->
279281

280282
请注意,传递的 `filename` 是一个已解码的 URL,如果函数返回了一个 URL 字符串,那么它也应该是已解码的。当 Vite 渲染 URL 时会自动处理编码。如果返回的是一个带有 `runtime` 的对象,就需要在必要的地方自行处理编码,因为运行时的代码将会按照原样呈现。

guide/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ import MyWorker from './worker?worker&url'
699699

700700
### [`'nonce-{RANDOM}'`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#nonce-base64-value)
701701

702-
当设置了 [`html.cspNonce`](/config/shared-options#html-cspnonce) 时,Vite 会在输出的脚本标签和样式表的链接标签中添加一个带有指定值的 nonce 属性。请注意,Vite 不会将 nonce 属性添加到其他标签中,例如 `<style>`。此外,设置此选项时,Vite 将注入一个 meta 标签`<meta property="csp-nonce" nonce="PLACEHOLDER" />`
702+
当设置了 [`html.cspNonce`](/config/shared-options#html-cspnonce) 时,Vite 会为任何 `<script>``<style>` 标签,以及样式表和模块预加载的 `<link>` 标签添加一个 nonce 属性。此外,当设置了这个选项时,Vite 会注入一个 meta 标签 (`<meta property="csp-nonce" nonce="PLACEHOLDER" />`)
703703

704704
带有 `property="csp-nonce"` 的 meta 标签的 nonce 值将在开发和构建后的必要时刻被 Vite 使用。
705705

index.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ hero:
2121
- theme: alt
2222
text: 在 GitHub 上查看
2323
link: https://github.com/vitejs/vite
24-
- theme: brand
25-
text: 🎉 ViteConf 23!
26-
link: https://viteconf.org/23/replay?utm=vite-homepage
2724

2825
features:
2926
- icon: 💡
@@ -53,4 +50,4 @@ import { fetchReleaseTag } from './.vitepress/utils/fetchReleaseTag.js'
5350
onMounted(() => {
5451
fetchReleaseTag()
5552
})
56-
</script>
53+
</script>

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"vite": "^5.1.6",
1616
"feed": "^4.2.2",
1717
"yorkie": "^2.0.0",
18-
"@shikijs/vitepress-twoslash": "^1.2.4",
18+
"@shikijs/vitepress-twoslash": "^1.3.0",
1919
"@types/express": "^4.17.21",
20-
"vitepress": "1.0.2",
21-
"vue": "^3.4.21"
20+
"vitepress": "1.1.3",
21+
"vue": "^3.4.24"
2222
},
2323
"scripts": {
2424
"dev": "vitepress dev .",

0 commit comments

Comments
 (0)