diff --git a/CHANGELOG.md b/CHANGELOG.md index 7faf553..6c88973 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # @taujs/server +v0.1.4 - 02/12/2024 + +fix: ssr css and preload links in header + v0.1.3 - 22/22/2024 chore(deps): bump cross-spawn and @changesets/cli diff --git a/package-lock.json b/package-lock.json index 8975b42..8b976b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@taujs/server", - "version": "0.1.3", + "version": "0.1.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@taujs/server", - "version": "0.1.3", + "version": "0.1.4", "license": "MIT", "dependencies": { "@fastify/static": "^7.0.4", diff --git a/package.json b/package.json index ed925dc..6f35743 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@taujs/server", - "version": "0.1.3", + "version": "0.1.4", "description": "taujs | τjs", "author": "Aoede (https://www.aoede.uk.net)", "license": "MIT", diff --git a/src/SSRServer.ts b/src/SSRServer.ts index a484515..9fb8597 100644 --- a/src/SSRServer.ts +++ b/src/SSRServer.ts @@ -144,8 +144,13 @@ export const SSRServer: FastifyPluginAsync = fp( const initialDataScript = ``; const { headContent, appHtml } = await renderSSR(initialDataResolved, req.url, attr?.meta); + let aggregateHeadContent = headContent; + + if (ssrManifest) aggregateHeadContent += preloadLinks; + if (manifest) aggregateHeadContent += cssLinks; + const fullHtml = template - .replace(SSRTAG.ssrHead, headContent) + .replace(SSRTAG.ssrHead, aggregateHeadContent) .replace(SSRTAG.ssrHtml, `${appHtml}${initialDataScript}`); return reply.status(200).header('Content-Type', 'text/html').send(fullHtml);