From a2f24fbeac943277a30b2adad763d537cd74de48 Mon Sep 17 00:00:00 2001 From: Kane Wang Date: Fri, 26 Apr 2024 21:26:43 +0800 Subject: [PATCH] add @playform/inline to lazy load css --- astro.config.mjs | 3 +++ package.json | 1 + pnpm-lock.yaml | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/astro.config.mjs b/astro.config.mjs index 356cc37..c1af52c 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -3,9 +3,11 @@ import react from "@astrojs/react"; import sitemap from "@astrojs/sitemap"; import tailwind from "@astrojs/tailwind"; import compress from "@playform/compress"; +import playformInline from "@playform/inline"; import robotsTxt from "astro-robots-txt"; import { defineConfig, sharpImageService } from "astro/config"; +// https://astro.build/config export default defineConfig({ site: "https://tools.yeecord.com", trailingSlash: "never", @@ -23,6 +25,7 @@ export default defineConfig({ sitemapBaseFileName: "sitemap-index", }), mdx(), + playformInline(), ], image: { service: sharpImageService(), diff --git a/package.json b/package.json index 3b30bd8..400ea1a 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@astrojs/sitemap": "^3.1.2", "@astrojs/tailwind": "^5.1.0", "@playform/compress": "^0.0.2", + "@playform/inline": "^0.0.2", "@radix-ui/react-dropdown-menu": "^2.0.6", "@radix-ui/react-label": "^2.0.2", "@radix-ui/react-navigation-menu": "^1.1.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8963184..7d93d6d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: '@playform/compress': specifier: ^0.0.2 version: 0.0.2 + '@playform/inline': + specifier: ^0.0.2 + version: 0.0.2 '@radix-ui/react-dropdown-menu': specifier: ^2.0.6 version: 2.0.6(@types/react-dom@18.2.24)(@types/react@18.2.74)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) @@ -802,6 +805,9 @@ packages: '@playform/compress@0.0.2': resolution: {integrity: sha512-dL/OxWTbWgjxjtwWiEtRYkgvDgurEsZRD8TerdhuKEVAtpmeofIH3wv9J5BxJ0pvEGMUfMiAX8jRpJOjE515Gw==, tarball: https://registry.npmjs.org/@playform/compress/-/compress-0.0.2.tgz} + '@playform/inline@0.0.2': + resolution: {integrity: sha512-2+h7t4mydMVJjP+U8PZhFz7iUlCqf/oGZX/Y5hUO72WeP6YD76MxkRSMCLJjXbqQkIQ2e5N3irbhz0JKKzMBTQ==, tarball: https://registry.npmjs.org/@playform/inline/-/inline-0.0.2.tgz} + '@playform/pipe@0.0.2': resolution: {integrity: sha512-1LJADjJVxUDIfpp5vkIup7vuxsZllWPYYbZO7gLN1CUcOFIekYSi1uxptkrYWBDRW/usiAyUdpd3gSKisED/sQ==, tarball: https://registry.npmjs.org/@playform/pipe/-/pipe-0.0.2.tgz} @@ -1754,6 +1760,9 @@ packages: resolution: {integrity: sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==, tarball: https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz} engines: {node: '>= 0.6'} + critters@0.0.22: + resolution: {integrity: sha512-NU7DEcQZM2Dy8XTKFHxtdnIM/drE312j2T4PCVaSUcS0oBeyT/NImpRw/Ap0zOr/1SE7SgPK9tGPg1WK/sVakw==, tarball: https://registry.npmjs.org/critters/-/critters-0.0.22.tgz} + cross-spawn@7.0.3: resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==, tarball: https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz} engines: {node: '>= 8'} @@ -2337,6 +2346,9 @@ packages: html-void-elements@3.0.0: resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==, tarball: https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz} + htmlparser2@8.0.2: + resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==, tarball: https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz} + http-cache-semantics@4.1.1: resolution: {integrity: sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==, tarball: https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz} @@ -3234,6 +3246,9 @@ packages: ts-node: optional: true + postcss-media-query-parser@0.2.3: + resolution: {integrity: sha512-3sOlxmbKcSHMjlUXQZKQ06jOswE7oVkXPxmZdoB1r5l0q6gTFTQSHxNxOrCccElbW7dxNytifNEo8qidX2Vsig==, tarball: https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz} + postcss-nested@6.0.1: resolution: {integrity: sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==, tarball: https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.1.tgz} engines: {node: '>=12.0'} @@ -4783,6 +4798,11 @@ snapshots: svgo: 3.2.0 terser: 5.30.3 + '@playform/inline@0.0.2': + dependencies: + '@playform/pipe': 0.0.2 + critters: 0.0.22 + '@playform/pipe@0.0.2': dependencies: '@types/node': 20.12.4 @@ -5859,6 +5879,16 @@ snapshots: cookie@0.6.0: {} + critters@0.0.22: + dependencies: + chalk: 4.1.2 + css-select: 5.1.0 + dom-serializer: 2.0.0 + domhandler: 5.0.3 + htmlparser2: 8.0.2 + postcss: 8.4.38 + postcss-media-query-parser: 0.2.3 + cross-spawn@7.0.3: dependencies: path-key: 3.1.1 @@ -6688,6 +6718,13 @@ snapshots: html-void-elements@3.0.0: {} + htmlparser2@8.0.2: + dependencies: + domelementtype: 2.3.0 + domhandler: 5.0.3 + domutils: 3.1.0 + entities: 4.5.0 + http-cache-semantics@4.1.1: {} human-signals@5.0.0: {} @@ -7788,6 +7825,8 @@ snapshots: optionalDependencies: postcss: 8.4.38 + postcss-media-query-parser@0.2.3: {} + postcss-nested@6.0.1(postcss@8.4.38): dependencies: postcss: 8.4.38