diff --git a/package.json b/package.json index fd66988..52a0f5f 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "scripts": { "test": "(tstest test/ --web)", "build": "(tsbuild --web)", - "format": "(gitzone format)" + "serve": "tsrun scripts/serve.ts" }, "devDependencies": { "@gitzone/tsbuild": "^2.1.25", diff --git a/test/test.ts b/test/test.ts index 0643f5e..179ef76 100644 --- a/test/test.ts +++ b/test/test.ts @@ -14,7 +14,7 @@ tap.test('should start the smartssr instance', async () => { }); tap.test('should render central.eu', async (tools) => { - await testSSRInstance.renderPage('https://in.work'); + await testSSRInstance.renderPage('https://lossless.com'); }); tap.skip.test('should render lossless.com', async () => { diff --git a/ts/smartssr.function.serialize.ts b/ts/smartssr.function.serialize.ts index e3468cb..ea1d02e 100644 --- a/ts/smartssr.function.serialize.ts +++ b/ts/smartssr.function.serialize.ts @@ -63,10 +63,12 @@ export function serializeFunction(rootNode) { const noteForAppending: HTMLElement[] = []; // lets care about static css first - if ((nodeArg.constructor as any).styles?.cssText) { - const styleTag = document.createElement('style'); - styleTag.textContent = prependCss(nodeUUID, (nodeArg.constructor as any).styles.cssText); - noteForAppending.push(styleTag); + if ((nodeArg.constructor as any).styles && (nodeArg.constructor as any).styles instanceof Array) { + for (const objectArg of (nodeArg.constructor as any).styles) { + const styleTag = document.createElement('style'); + styleTag.textContent = prependCss(nodeUUID, objectArg.cssText); + noteForAppending.push(styleTag); + } } childNodes.forEach((childNode) => {