2022-11-27

週刊 Astro 3

Scripts and Event Handling ドキュメントの追加

Add new “Scripts and Event Handling” guide により、Astro における <script> タグの使用方法についての新しいガイドがドキュメントに追加されました:

Scripts and Event Handling 🚀 Astro Documentation
Scripts and Event Handling 🚀 Astro Documentation
How to add client-side interactivity to Astro components using native browser JavaScript APIs.
docs.astro.build

イベントリスナーの追加方法やカスタム要素の書き方、frontmatter から script へのデータの受け渡し方などについて書かれています。

Cloudflare Pages における静的アセットの扱いの改善など

@astrojs/[email protected] により、Cloudflare Pages において静的アセットを扱う際にワーカーの実行が不要となりました。また、public/ ディレクトリへの _routes.json_redirects_headers ファイルの配置もサポートされました。対応するプルリクエストは

Use Cloudflare Pages to serve static assets and support `_headers`, `_redirects` and `_routes.json` by AirBorne04 · Pull Request #5347 · withastro/astro · GitHub
Use Cloudflare Pages to serve static assets and support `_headers`, `_redirects` and `_routes.json` by AirBorne04 · Pull Request #5347 · withastro/astro · GitHub
Changes Eliminates the need for worker invocation to serve static files (reduces cost of running the page) Support for _headers, _redirects and routes.jsonfiles addressing #5245 and follow up on #5290 Testing Did test run the Solid and React example projects with the cloudflare adapter. Docs There could be a new section on the Docs explaining how to use _headers, _redirects and _routes.json files with cloudflare. Linking to their Docs for headers, redirects and routes. One speciality with the _routes.json file is that it is auto generated for the assets to be excluded from functions invocation. If there is a routes file present from the user it will not be replaced, but therefore the asset handling is falling back to the worker, which resolves the assets. /cc @withastro/maintainers-docs for feedback!
github.com

となります。

その他