import template from './template'; // Template function for rendering the boilerplate html for cordova export const headTemplate = ({ meteorRuntimeConfig, rootUrlPathPrefix, inlineScriptsAllowed, css, js, additionalStaticJs, htmlAttributes, bundledJsCssUrlRewriteHook, head, dynamicHead, }) => { var headSections = head.split(/]*>/, 2); var cssBundle = [ // We are explicitly not using bundledJsCssUrlRewriteHook: in cordova we serve assets up directly from disk, so rewriting the URL does not make sense ...(css || []).map(file => template(' ')({ href: file.url, }) )].join('\n'); return [ '', '', ' ', ' ', ' ', ' ', ' ', (headSections.length === 1) ? [cssBundle, headSections[0]].join('\n') : [headSections[0], cssBundle, headSections[1]].join('\n'), ' ', '', ' ', ...(js || []).map(file => template(' ')({ src: file.url, }) ), ...(additionalStaticJs || []).map(({ contents, pathname }) => ( inlineScriptsAllowed ? template(' ')({ contents, }) : template(' ')({ src: rootUrlPathPrefix + pathname }) )), '', head, '', '', '', ].join('\n'); }; export function closeTemplate() { return "\n"; }