mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 21:55:11 +00:00
perf(nuxt): remove some line breaks when rendering html (#24888)
This commit is contained in:
parent
3cdef69dbd
commit
13c42d35b3
@ -412,9 +412,9 @@ export default defineRenderHandler(async (event): Promise<Partial<RenderResponse
|
|||||||
// Create render context
|
// Create render context
|
||||||
const htmlContext: NuxtRenderHTMLContext = {
|
const htmlContext: NuxtRenderHTMLContext = {
|
||||||
island: Boolean(islandContext),
|
island: Boolean(islandContext),
|
||||||
htmlAttrs: [htmlAttrs],
|
htmlAttrs: htmlAttrs ? [htmlAttrs] : [],
|
||||||
head: normalizeChunks([headTags, ssrContext.styles]),
|
head: normalizeChunks([headTags, ssrContext.styles]),
|
||||||
bodyAttrs: [bodyAttrs],
|
bodyAttrs: bodyAttrs ? [bodyAttrs] : [],
|
||||||
bodyPrepend: normalizeChunks([bodyTagsOpen, ssrContext.teleports?.body]),
|
bodyPrepend: normalizeChunks([bodyTagsOpen, ssrContext.teleports?.body]),
|
||||||
body: [process.env.NUXT_COMPONENT_ISLANDS ? replaceClientTeleport(ssrContext, replaceServerOnlyComponentsSlots(ssrContext, _rendered.html)) : _rendered.html],
|
body: [process.env.NUXT_COMPONENT_ISLANDS ? replaceClientTeleport(ssrContext, replaceServerOnlyComponentsSlots(ssrContext, _rendered.html)) : _rendered.html],
|
||||||
bodyAppend: [bodyTags]
|
bodyAppend: [bodyTags]
|
||||||
@ -502,11 +502,11 @@ function joinAttrs (chunks: string[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderHTMLDocument (html: NuxtRenderHTMLContext) {
|
function renderHTMLDocument (html: NuxtRenderHTMLContext) {
|
||||||
return `<!DOCTYPE html>
|
return '<!DOCTYPE html>'
|
||||||
<html ${joinAttrs(html.htmlAttrs)}>
|
+ `<html${joinAttrs(html.htmlAttrs)}>`
|
||||||
<head>${joinTags(html.head)}</head>
|
+ `<head>${joinTags(html.head)}</head>`
|
||||||
<body ${joinAttrs(html.bodyAttrs)}>${joinTags(html.bodyPrepend)}${joinTags(html.body)}${joinTags(html.bodyAppend)}</body>
|
+ `<body${joinAttrs(html.bodyAttrs)}>${joinTags(html.bodyPrepend)}${joinTags(html.body)}${joinTags(html.bodyAppend)}</body>`
|
||||||
</html>`
|
+ '</html>'
|
||||||
}
|
}
|
||||||
|
|
||||||
async function renderInlineStyles (usedModules: Set<string> | string[]): Promise<Style[]> {
|
async function renderInlineStyles (usedModules: Set<string> | string[]): Promise<Style[]> {
|
||||||
|
Loading…
Reference in New Issue
Block a user