diff --git a/packages/boilerplate-generator/template-web.browser.js b/packages/boilerplate-generator/template-web.browser.js index 67e3b5349b..f0ac77f449 100644 --- a/packages/boilerplate-generator/template-web.browser.js +++ b/packages/boilerplate-generator/template-web.browser.js @@ -6,29 +6,26 @@ export const headTemplate = ({ bundledJsCssUrlRewriteHook, head, dynamicHead, -}) => [].concat( - [ - ' - template(' <%= attrName %>="<%- attrValue %>"')({ - attrName: key, - attrValue: htmlAttributes[key] - }) - ).join('') + '>', - '
' - ], +}) => [ + ' template(' <%= attrName %>="<%- attrValue %>"')({ + attrName: key, + attrValue: htmlAttributes[key], + }) + ).join('') + '>', + '', - (css || []).map(({ url }) => + ...(css || []).map(file => template(' ')({ - href: bundledJsCssUrlRewriteHook(url) + href: bundledJsCssUrlRewriteHook(file.url), }) ), - [ - head, - dynamicHead, - '', - '', - ], -).join('\n') + + head, + dynamicHead, + '', + '', +].join('\n'); // Template function for rendering the boilerplate html for browsers export const closeTemplate = ({ @@ -38,39 +35,35 @@ export const closeTemplate = ({ js, additionalStaticJs, bundledJsCssUrlRewriteHook, -}) => [].concat( - [ - '', - (inlineScriptsAllowed - ? template(' ')({ - conf: meteorRuntimeConfig - }) - : template(' ')({ - src: rootUrlPathPrefix - }) - ) , - '' - ], +}) => [ + '', + inlineScriptsAllowed + ? template(' ')({ + conf: meteorRuntimeConfig, + }) + : template(' ')({ + src: rootUrlPathPrefix, + }), + '', - (js || []).map(({ url }) => + ...(js || []).map(file => template(' ')({ - src: bundledJsCssUrlRewriteHook(url) + src: bundledJsCssUrlRewriteHook(file.url), }) ), - (additionalStaticJs || []).map(({ contents, pathname }) => ( - (inlineScriptsAllowed + ...(additionalStaticJs || []).map(({ contents, pathname }) => ( + inlineScriptsAllowed ? template(' ')({ - contents: contents + contents, }) : template(' ')({ - src: rootUrlPathPrefix + pathname - })) + src: rootUrlPathPrefix + pathname, + }) )), - [ - '', '', - '', - '' - ], -).join('\n'); + '', + '', + '', + '' +].join('\n'); diff --git a/packages/boilerplate-generator/template-web.cordova.js b/packages/boilerplate-generator/template-web.cordova.js index b6a9a01393..a2870e3066 100644 --- a/packages/boilerplate-generator/template-web.cordova.js +++ b/packages/boilerplate-generator/template-web.cordova.js @@ -12,64 +12,61 @@ export const headTemplate = ({ bundledJsCssUrlRewriteHook, head, dynamicHead, -}) => [].concat( - [ - '', - '', - ' ', - ' ', - ' ', - ' ', - ' ', - ], +}) => [ + '', + '', + ' ', + ' ', + ' ', + ' ', + ' ', + // 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(({ url }) => + ...(css || []).map(file => template(' ')({ - href: url - }) - ), - [ - ' ', - '', - ' ' - ], - (js || []).map(({ url }) => - template(' ')({ - src: url + href: file.url, }) ), - (additionalStaticJs || []).map(({ contents, pathname }) => ( - (inlineScriptsAllowed + ' ', + '', + ' ', + + ...(js || []).map(file => + template(' ')({ + src: file.url, + }) + ), + + ...(additionalStaticJs || []).map(({ contents, pathname }) => ( + inlineScriptsAllowed ? template(' ')({ - contents: contents + contents, }) : template(' ')({ src: rootUrlPathPrefix + pathname - })) + }) )), + '', + head, + '', + '', + '', +].join('\n'); - [ - '', - head, - '', - '', - '', - ], -).join('\n'); - -export const closeTemplate = () => - [].concat([ '','' ]).join('\n'); +export function closeTemplate() { + return "\n"; +}