partial() { // TODO: Fix this mess const target = this._template const data = this.pages[target] const withoutContainer = StyleSheetServer.renderStatic(() => { if (data) { if (data.template === 'contact') { return ( <div> <Title data={data} /> <ContactForm /> </div> ) } else if (data.template === 'experience') { return ( <div> <Title data={data} /> <Description text={data.description} /> <Experience jobs={data.jobs} /> </div> ) } else { return ( <div> <Title data={data} /> <Description text={data.description} /> </div> ) } } }) const withContainer = StyleSheetServer.renderStatic(() => { return ( <View route={target}> <Container target={target}>{withoutContainer.html}</Container> </View> ) }) return { html: withContainer.html, css: withoutContainer.css, forFull: withoutContainer.html } }
export const aphroditeNoImportantCase = caseName => { const useStyles = StyleSheet.create(stylesheet) const getButtonClassName = i => aphroditeCss(useStyles[buttonClassNames[i]]) const { html, css } = StyleSheetServer.renderStatic(() => { return renderBody(caseName, aphroditeCss(useStyles.container), getButtonClassName) }) StyleSheetTestUtils.clearBufferAndResumeStyleInjection() return renderHtml(css.content, html) }
full() { const revisionedAssetManifest = fs.readJsonSync(path.join(config.publicDir, config.manifestFileName), { throws: false }) || {} const target = this._template const data = this.pages[target] const partial = this.parsed[this._template].partial const full = StyleSheetServer.renderStatic(() => { return ( <html> <head> <meta charset="utf-8" /> <meta name="author" content="Rick Smit" /> <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1" /> <meta name="theme-color" content="#FF00FF" /> <meta name="version" content={process.env.npm_package_version} /> <meta property="article:published_time" content={data.updatedAt} /> <style data-aphrodite>{STYLES}</style> <title>{`Rick Smit - ${target}`}</title> <link rel="stylesheet" href="/style.css" /> <script src="//cdnjs.cloudflare.com/ajax/libs/document-register-element/1.5.0/document-register-element.js" /> <link rel="preload" href="/" /> <link rel="preload" href="/about/" /> <link rel="preload" href="/contact/" /> <link rel="preload" href="/experience/" /> <script type="module" src={`/dist/${revisionedAssetManifest['runtime.js']}`} /> <script type="module" src={`/dist/${revisionedAssetManifest['main.js']}`} /> </head> <body> <Header /> {Object.keys(this.pages).map(key => { if (key !== target) { // dont show coverletters in the router if ( (!this.pages[target].cover && !this.pages[key].cover) || (this.pages[target].cover && key !== 'home') ) { return <View remote route={key} /> } } })} <View route={target}> <Container target={target}>{partial.forFull}</Container> </View> <sc-router /> <script nomodule src={`/dist/${revisionedAssetManifest['runtime-legacy.js']}`} /> <script nomodule src={`/dist/${revisionedAssetManifest['main-legacy.js']}`} /> </body> </html> ) }) full.html = full.html.replace( STYLES, full.css.content + partial.css.content ) return full }