// @flow /* eslint-disable import/no-extraneous-dependencies */ import serialize from 'serialize-javascript' // @flow-disable-next-line import { WDS_PATH } from '@sharyn/webpack-config/wds-util' // @flow-disable-next-line import { NO_SSR, SSR_ONLY } from '@sharyn/env' // @flow-disable-next-line import { hasPackage } from '@sharyn/check-setup' import CleanCSS from 'clean-css' const robotoLink = ` ` type Params = { windowVars?: any[], rootId?: string, appHtml?: string, css?: string, helmet?: Object, swPath?: string, } const htmlBase = ({ windowVars: windowVarPairs, rootId = 'app', appHtml = '', css, helmet, swPath, }: Params) => { const windowVarsScriptTags = windowVarPairs ? windowVarPairs.map(p => ` `).join(` `) : '' return ` ${!NO_SSR && helmet ? helmet.title.toString() : ''} ${!NO_SSR && helmet ? helmet.meta.toString() : ''} ${!NO_SSR && helmet ? helmet.link.toString() : ''} ${hasPackage('@material-ui/core') ? robotoLink : ''} ${!NO_SSR && css ? ` ` : ''}
${NO_SSR ? '' : appHtml}
${ swPath ? ` ` : '' } ${SSR_ONLY ? '' : windowVarsScriptTags} ${SSR_ONLY ? '' : ` `} ` } module.exports = htmlBase