in modules/aspnetcore-engine/src/main.ts [18:60]
function _getUniversalData(content: string, appSelector: string): IEngineRenderResult {
const doc = createDocument(content, true);
const styles: string[] = [];
const scripts: string[] = [];
const meta: string[] = [];
const links: string[] = [];
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const elements = [...Array.from(doc.head!.children), ...Array.from(doc.body!.children)];
for (const element of elements) {
switch (element.tagName.toUpperCase()) {
case 'SCRIPT':
scripts.push(element.outerHTML);
break;
case 'STYLE':
styles.push(element.outerHTML);
break;
case 'LINK':
links.push(element.outerHTML);
break;
case 'META':
meta.push(element.outerHTML);
break;
default:
break;
}
}
return {
completeHTML: content,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
html: doc.querySelector(appSelector)!.outerHTML,
globals: {
title: doc.title,
scripts: scripts.join('\n'),
styles: styles.join('\n'),
meta: meta.join('\n'),
links: links.join('\n'),
},
};
}