From e3089167ca4a387cf40f42291b70a7d254cbf149 Mon Sep 17 00:00:00 2001 From: huyikai Date: Fri, 16 Feb 2024 17:44:20 +0800 Subject: [PATCH 1/3] i18n(zh-ch): Update `fonts.mdx` --- src/content/docs/zh-cn/guides/fonts.mdx | 31 +++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/content/docs/zh-cn/guides/fonts.mdx b/src/content/docs/zh-cn/guides/fonts.mdx index eb28d4807b48a..327927ceb1532 100644 --- a/src/content/docs/zh-cn/guides/fonts.mdx +++ b/src/content/docs/zh-cn/guides/fonts.mdx @@ -99,24 +99,25 @@ import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'; 要在 Tailwind 中注册你的字体: 1. 请遵循上述任一指南,但跳过添加 `font-family` 到 CSS 的最后一步。 -1. 将字体名称添加到 `tailwind.config.cjs`。 +1. 将字体名称添加到 `tailwind.config.mjs`。 此示例将添加 `InterVariable` 和 `Inter` 到 sans-serif 字体堆栈,并使用 Tailwind CSS 的默认备用字体。 - ```js title="tailwind.config.cjs" ins={1,7-9} - const defaultTheme = require("tailwindcss/defaultTheme"); - - module.exports = { - // ... - theme: { - extend: { - fontFamily: { - sans: ["InterVariable", "Inter", ...defaultTheme.fontFamily.sans], - }, - }, - }, - // ... - }; + ```js title="tailwind.config.mjs" ins={1,8-10} + import defaultTheme from 'tailwindcss/defaultTheme' + + /** @type {import('tailwindcss').Config} */ + export default { + content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], + theme: { + extend: { + fontFamily: { + sans: ['Inter', ...defaultTheme.fontFamily.sans], + }, + }, + }, + plugins: [], + } ``` 现在,项目中的所有 sans-serif 文本(Tailwind 的默认设置)都将使用你选择的字体,并且该类 `font-sans` 也将应用 Inter 字体。 From f3cccf083da626213b18042ef1d0e56a34d71f0d Mon Sep 17 00:00:00 2001 From: huyikai Date: Fri, 16 Feb 2024 18:28:47 +0800 Subject: [PATCH 2/3] i18n(zh-cn): Update `fonts.mdx` --- src/content/docs/zh-cn/guides/fonts.mdx | 31 ++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/content/docs/zh-cn/guides/fonts.mdx b/src/content/docs/zh-cn/guides/fonts.mdx index 327927ceb1532..eb28d4807b48a 100644 --- a/src/content/docs/zh-cn/guides/fonts.mdx +++ b/src/content/docs/zh-cn/guides/fonts.mdx @@ -99,25 +99,24 @@ import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'; 要在 Tailwind 中注册你的字体: 1. 请遵循上述任一指南,但跳过添加 `font-family` 到 CSS 的最后一步。 -1. 将字体名称添加到 `tailwind.config.mjs`。 +1. 将字体名称添加到 `tailwind.config.cjs`。 此示例将添加 `InterVariable` 和 `Inter` 到 sans-serif 字体堆栈,并使用 Tailwind CSS 的默认备用字体。 - ```js title="tailwind.config.mjs" ins={1,8-10} - import defaultTheme from 'tailwindcss/defaultTheme' - - /** @type {import('tailwindcss').Config} */ - export default { - content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'], - theme: { - extend: { - fontFamily: { - sans: ['Inter', ...defaultTheme.fontFamily.sans], - }, - }, - }, - plugins: [], - } + ```js title="tailwind.config.cjs" ins={1,7-9} + const defaultTheme = require("tailwindcss/defaultTheme"); + + module.exports = { + // ... + theme: { + extend: { + fontFamily: { + sans: ["InterVariable", "Inter", ...defaultTheme.fontFamily.sans], + }, + }, + }, + // ... + }; ``` 现在,项目中的所有 sans-serif 文本(Tailwind 的默认设置)都将使用你选择的字体,并且该类 `font-sans` 也将应用 Inter 字体。 From 2799ce6011da4b3c31556e8101ce99ae53beaae4 Mon Sep 17 00:00:00 2001 From: huyikai Date: Tue, 12 Mar 2024 09:43:46 +0800 Subject: [PATCH 3/3] 20240312: Create `astro-response-headers-reassigned.mdx` --- src/content/docs/zh-cn/reference/error-reference.mdx | 1 + .../errors/astro-response-headers-reassigned.mdx | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 src/content/docs/zh-cn/reference/errors/astro-response-headers-reassigned.mdx diff --git a/src/content/docs/zh-cn/reference/error-reference.mdx b/src/content/docs/zh-cn/reference/error-reference.mdx index 2f1bd39e4868c..a789fd8c4372d 100644 --- a/src/content/docs/zh-cn/reference/error-reference.mdx +++ b/src/content/docs/zh-cn/reference/error-reference.mdx @@ -49,6 +49,7 @@ githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/ - [**MiddlewareNoDataOrNextCalled**](/zh-cn/reference/errors/middleware-no-data-or-next-called/)
The middleware didn't return a `Response`. - [**MiddlewareNotAResponse**](/zh-cn/reference/errors/middleware-not-aresponse/)
The middleware returned something that is not a `Response` object. - [**LocalsNotAnObject**](/zh-cn/reference/errors/locals-not-an-object/)
Value assigned to `locals` is not accepted. +- [**AstroResponseHeadersReassigned**](/zh-cn/reference/errors/astro-response-headers-reassigned/)
`Astro.response.headers` must not be reassigned. - [**MiddlewareCantBeLoaded**](/zh-cn/reference/errors/middleware-cant-be-loaded/)
Can't load the middleware. - [**LocalImageUsedWrongly**](/zh-cn/reference/errors/local-image-used-wrongly/)
Local images must be imported. - [**AstroGlobUsedOutside**](/zh-cn/reference/errors/astro-glob-used-outside/)
Astro.glob() used outside of an Astro file. diff --git a/src/content/docs/zh-cn/reference/errors/astro-response-headers-reassigned.mdx b/src/content/docs/zh-cn/reference/errors/astro-response-headers-reassigned.mdx new file mode 100644 index 0000000000000..afc7440f3c49a --- /dev/null +++ b/src/content/docs/zh-cn/reference/errors/astro-response-headers-reassigned.mdx @@ -0,0 +1,10 @@ +--- +title: Astro.response.headers must not be reassigned. +i18nReady: true +githubURL: https://github.com/withastro/astro/blob/main/packages/astro/src/core/errors/errors-data.ts +--- + +> **AstroResponseHeadersReassigned**: 可以向 `Astro.response.headers` 添加或删除单个头部,但不得将其整体替换为另一个 `Headers` 实例。 + +## 哪里出了问题? +当尝试将一个值设置为可用于 `Astro.response` 的 `ResponseInit` 对象上的 `headers` 字段时抛出此错误。